Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 2e514606 authored by Ken Chen's avatar Ken Chen Committed by Automerger Merge Worker
Browse files

Fix -Wnullable-to-nonnull-conversion errors am: 4730f0d7

parents 2d0750b2 4730f0d7
Loading
Loading
Loading
Loading
+6 −3
Original line number Diff line number Diff line
@@ -279,9 +279,11 @@ static struct hostent* getanswer(const querybuf* _Nonnull answer, int anslen, co
                }
                break;
            case T_A:
            case T_AAAA:
                if (strcasecmp(hent->h_name, bp) != 0) {
                    LOG(DEBUG) << __func__ << ": asked for \"" << hent->h_name << "\", got \"" << bp
            case T_AAAA: {
                if (hent->h_name == NULL) goto no_recovery;
                const char* h_name = hent->h_name;
                if (strcasecmp(h_name, bp) != 0) {
                    LOG(DEBUG) << __func__ << ": asked for \"" << h_name << "\", got \"" << bp
                               << "\"";
                    cp += n;
                    continue; /* XXX - had_error++ ? */
@@ -325,6 +327,7 @@ static struct hostent* getanswer(const querybuf* _Nonnull answer, int anslen, co
                cp += n;
                if (cp != erdata) goto no_recovery;
                break;
            }
            default:
                abort();
        }
+6 −6
Original line number Diff line number Diff line
@@ -101,7 +101,12 @@ int _hf_gethtbyname2(const char* name, int af, getnamaddr* info) {
            break;
        }

        if (strcasecmp(hp->h_name, name) != 0) {
        if (hp->h_name == nullptr) {
            free(buf);
            return EAI_FAIL;
        }
        const char* h_name = hp->h_name;
        if (strcasecmp(h_name, name) != 0) {
            char** cp;
            for (cp = hp->h_aliases; *cp != NULL; cp++)
                if (strcasecmp(*cp, name) == 0) break;
@@ -113,11 +118,6 @@ int _hf_gethtbyname2(const char* name, int af, getnamaddr* info) {
            hent.h_addrtype = hp->h_addrtype;
            hent.h_length = hp->h_length;

            if (hp->h_name == nullptr) {
                free(buf);
                return EAI_FAIL;
            }
            const char* h_name = hp->h_name;
            HENT_SCOPY(hent.h_name, h_name, ptr, len);
            for (anum = 0; hp->h_aliases[anum]; anum++) {
                if (anum >= MAXALIASES) goto nospc;