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
diff --git a/resolv/res_cache.cpp b/resolv/res_cache.cpp
index a38fc4c..ad5a2c5 100644
--- a/resolv/res_cache.cpp
+++ b/resolv/res_cache.cpp
@@ -1016,13 +1016,12 @@
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;
diff --git a/resolv/res_send.cpp b/resolv/res_send.cpp
index b0f6b2f..118a081 100644
--- a/resolv/res_send.cpp
+++ b/resolv/res_send.cpp
@@ -959,7 +959,7 @@
}
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 @@
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 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) {