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

Commit c1d47171 authored by Treehugger Robot's avatar Treehugger Robot Committed by Gerrit Code Review
Browse files

Merge "Remove accessing errno in setQueryId()"

parents 675d6730 af16700e
Loading
Loading
Loading
Loading
+9 −4
Original line number Diff line number Diff line
@@ -239,7 +239,7 @@ int resNSendToAiError(int err, int rcode) {

bool setQueryId(span<uint8_t> msg, uint16_t query_id) {
    if ((size_t)msg.size() < sizeof(HEADER)) {
        errno = EINVAL;
        LOG(ERROR) << __func__ << ": Invalid parameter";
        return false;
    }
    auto hp = reinterpret_cast<HEADER*>(msg.data());
@@ -1085,9 +1085,14 @@ void DnsProxyListener::ResNSendHandler::run() {
        return;
    }

    // Restore query id and send answer
    if (!setQueryId({ansBuf.data(), ansLen}, original_query_id) ||
        !sendLenAndData(mClient, ansLen, ansBuf.data())) {
    // Restore query id
    if (!setQueryId({ansBuf.data(), ansLen}, original_query_id)) {
        LOG(WARNING) << "ResNSendHandler::run: resnsend: failed to restore query id";
        return;
    }

    // Send answer
    if (!sendLenAndData(mClient, ansLen, ansBuf.data())) {
        PLOG(WARNING) << "ResNSendHandler::run: resnsend: failed to send answer to uid " << uid
                      << " pid " << mClient->getPid();
        return;
+0 −1
Original line number Diff line number Diff line
@@ -1792,7 +1792,6 @@ static int res_searchN(const char* name, res_target* target, ResState* res, int*

    hp = (HEADER*)(void*)target->answer.data();

    errno = 0;
    *herrno = HOST_NOT_FOUND; /* default, if we never query */
    dots = 0;
    for (cp = name; *cp; cp++) dots += (*cp == '.');
+0 −1
Original line number Diff line number Diff line
@@ -211,7 +211,6 @@ int res_nsearch(ResState* statp, const char* name, /* domain name */
    int got_nodata = 0, got_servfail = 0, root_on_list = 0;
    int tried_as_is = 0;

    errno = 0;
    *herrno = HOST_NOT_FOUND; /* True if we never query. */

    dots = 0;
+0 −1
Original line number Diff line number Diff line
@@ -780,7 +780,6 @@ same_ns:
                return -1;
            }
        }
        errno = 0;
        if (random_bind(statp->tcp_nssock, nsap->sa_family) < 0) {
            *terrno = errno;
            dump_error("bind/vc", nsap);