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

Commit 3b8f5902 authored by Elliott Hughes's avatar Elliott Hughes
Browse files

netd: use PLOG where appropriate.

Also, libbase logging promises not to clobber errno, so you don't need
to save/restore errno around logging calls (because that would be a huge
pain).

Test: builds
Change-Id: I9315fc885c7cf224a4f22fd4746f57931f6d556f
parent 70931aa0
Loading
Loading
Loading
Loading
+2 −3
Original line number Diff line number Diff line
@@ -1016,13 +1016,12 @@ static u_long answer_getTTL(const void* answer, int answerlen) {
                        result = ttl;
                    }
                } else {
                    LOG(INFO) << "ns_parserr failed ancount no = " << n
                              << ". errno = " << strerror(errno);
                    PLOG(INFO) << "ns_parserr failed ancount no = " << n;
                }
            }
        }
    } else {
        LOG(INFO) << "ns_initparse failed: " << strerror(errno);
        PLOG(INFO) << "ns_initparse failed";
    }

    LOG(INFO) << "TTL = " << result;
+4 −5
Original line number Diff line number Diff line
@@ -959,7 +959,7 @@ retry:
    }
    if (n < 0) {
        if (errno == EINTR) goto retry;
        LOG(INFO) << "  " << sock << " retrying_poll got error " << n;
        PLOG(INFO) << "  " << sock << " retrying_poll failed";
        return n;
    }
    if (fds.revents & (POLLIN | POLLOUT | POLLERR)) {
@@ -967,7 +967,7 @@ retry:
        socklen_t len = sizeof(error);
        if (getsockopt(sock, SOL_SOCKET, SO_ERROR, &error, &len) < 0 || error) {
            errno = error;
            LOG(INFO) << "  " << sock << " retrying_poll dot error2 " << errno;
            PLOG(INFO) << "  " << sock << " retrying_poll getsockopt failed";
            return -1;
        }
    }
@@ -1188,10 +1188,9 @@ static void Aerror(const res_state statp, const char* string, int error,
}

static void Perror(const res_state statp, const char* string, int error) {
    const int save = errno;
    if ((statp->options & RES_DEBUG) != 0U)
    if ((statp->options & RES_DEBUG) != 0U) {
        LOG(DEBUG) << "res_send: " << string << ": " << strerror(error);
    errno = save;
    }
}

static int sock_eq(struct sockaddr* a, struct sockaddr* b) {