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

Commit 68953424 authored by chenbruce's avatar chenbruce
Browse files

[Resolver-log]: ResolverTest fail when enabling VERBOSE log severity.

Run resolv_integration_test --gtest_filter=ResolverTest.GetAddrInfo_cnamesIllegalRdata,
resolver will stuck becuase the do_section function doesn't handle well.

Bug: 130785203
Test: make; flash; enable verbose severity and run tests case.
Change-Id: I9ee9ce6f61e791392430a74ecd16f8e44e5bec99
parent 37255186
Loading
Loading
Loading
Loading
+7 −4
Original line number Diff line number Diff line
@@ -143,7 +143,6 @@ static void do_section(ns_msg* handle, ns_sect section) {
    /*
     * Print answer records.
     */
    auto buf = std::make_unique<char[]>(buflen);
    for (;;) {
        if (ns_parserr(handle, section, rrnum, &rr)) {
            if (errno != ENODEV) StringAppendF(&s, "ns_parserr: %s", strerror(errno));
@@ -202,13 +201,18 @@ static void do_section(ns_msg* handle, ns_sect section) {
                cp += optlen;
            }
        } else {
            auto buf = std::make_unique<char[]>(buflen);
            n = ns_sprintrr(handle, &rr, NULL, NULL, buf.get(), (u_int)buflen);
            if (n < 0) {
                if (errno == ENOSPC) {
                    if (buflen < 131072) {
                        buf = std::make_unique<char[]>(buflen += 1024);
                    }
                        buflen += 1024;
                        continue;
                    } else {
                        StringAppendF(&s, "buflen over 131072");
                        PLOG(VERBOSE) << s;
                        return;
                    }
                }
                StringAppendF(&s, "ns_sprintrr failed");
                PLOG(VERBOSE) << s;
@@ -218,7 +222,6 @@ static void do_section(ns_msg* handle, ns_sect section) {
        }
        rrnum++;
    }
    LOG(VERBOSE) << s;
}

/*