Use PLOG rather than LOG strerror(errno).
Test: builds
Change-Id: I75c3311ce00fccc79b8efc198ce69ffed96e805a
diff --git a/common/reactor.cc b/common/reactor.cc
index 61cc7d6..8097732 100644
--- a/common/reactor.cc
+++ b/common/reactor.cc
@@ -170,7 +170,7 @@
if (result == -1 && errno == ENOENT) {
LOG(INFO) << __func__ << ": reactable is invalid or unregistered";
} else if (result == -1) {
- LOG(FATAL) << __func__ << ": failed: " << strerror(errno);
+ PLOG(FATAL) << __func__ << ": failed";
}
// If we are unregistering during the callback event from this reactable, we delete it after the callback is executed.
// reactable->is_executing_ is protected by reactable->lock_, so it's thread safe.
diff --git a/common/thread.cc b/common/thread.cc
index 2cb2205..274eee9 100644
--- a/common/thread.cc
+++ b/common/thread.cc
@@ -42,7 +42,7 @@
int rc;
RUN_NO_INTR(rc = sched_setscheduler(linux_tid, SCHED_FIFO, &rt_params));
if (rc != 0) {
- LOG(ERROR) << __func__ << ": unable to set SCHED_FIFO priority: " << strerror(errno);
+ PLOG(ERROR) << __func__ << ": unable to set SCHED_FIFO priority";
}
}
reactor_.Run();
diff --git a/hci/src/hci_layer_linux.cc b/hci/src/hci_layer_linux.cc
index 5a3dacc..cc2c9a5 100644
--- a/hci/src/hci_layer_linux.cc
+++ b/hci/src/hci_layer_linux.cc
@@ -203,12 +203,12 @@
addr.hci_dev = hci_interface;
addr.hci_channel = HCI_CHANNEL_USER;
if (bind(fd, (struct sockaddr*)&addr, sizeof(addr)) < 0) {
- LOG(FATAL) << "socket bind error " << strerror(errno);
+ PLOG(FATAL) << "socket bind error";
}
int sv[2];
if (socketpair(AF_UNIX, SOCK_STREAM, 0, sv) < 0) {
- LOG(FATAL) << "socketpair failed: " << strerror(errno);
+ PLOG(FATAL) << "socketpair failed";
}
reader_thread_ctrl_fd = sv[0];
@@ -274,7 +274,7 @@
if (ret != packet->len + 1) LOG(ERROR) << "Should have send whole packet";
- if (ret == -1) LOG(FATAL) << strerror(errno);
+ if (ret == -1) PLOG(FATAL) << "write failed";
}
static int wait_hcidev(void) {
@@ -288,7 +288,7 @@
fd = socket(PF_BLUETOOTH, SOCK_RAW, BTPROTO_HCI);
if (fd < 0) {
- LOG(ERROR) << "Bluetooth socket error: %s" << strerror(errno);
+ PLOG(ERROR) << "Bluetooth socket error";
return -1;
}
@@ -298,7 +298,7 @@
addr.hci_channel = HCI_CHANNEL_CONTROL;
if (bind(fd, (struct sockaddr*)&addr, sizeof(addr)) < 0) {
- LOG(ERROR) << "HCI Channel Control: " << strerror(errno);
+ PLOG(ERROR) << "HCI Channel Control";
close(fd);
return -1;
}
@@ -314,7 +314,7 @@
ssize_t wrote;
OSI_NO_INTR(wrote = write(fd, &ev, 6));
if (wrote != 6) {
- LOG(ERROR) << "Unable to write mgmt command: " << strerror(errno);
+ PLOG(ERROR) << "Unable to write mgmt command";
ret = -1;
goto end;
}
@@ -323,7 +323,7 @@
int n;
OSI_NO_INTR(n = poll(fds, 1, MGMT_EV_POLL_TIMEOUT));
if (n == -1) {
- LOG(ERROR) << "Poll error: " << strerror(errno);
+ PLOG(ERROR) << "Poll error";
ret = -1;
break;
} else if (n == 0) {
@@ -335,7 +335,7 @@
if (fds[0].revents & POLLIN) {
OSI_NO_INTR(n = read(fd, &ev, sizeof(struct mgmt_pkt)));
if (n < 0) {
- LOG(ERROR) << "Error reading control channel: " << strerror(errno);
+ PLOG(ERROR) << "Error reading control channel";
ret = -1;
break;
}
diff --git a/service/ipc/ipc_handler_linux.cc b/service/ipc/ipc_handler_linux.cc
index 7fe724e..ebfae12 100644
--- a/service/ipc/ipc_handler_linux.cc
+++ b/service/ipc/ipc_handler_linux.cc
@@ -89,7 +89,7 @@
sizeof(address.sun_path) - 1);
if (bind(server_socket.get(), (struct sockaddr*)&address, sizeof(address)) <
0) {
- LOG(ERROR) << "Failed to bind IPC socket to address: " << strerror(errno);
+ PLOG(ERROR) << "Failed to bind IPC socket to address";
return false;
}
@@ -141,7 +141,7 @@
int status = listen(socket_.get(), SOMAXCONN);
if (status < 0) {
- LOG(ERROR) << "Failed to listen on domain socket: " << strerror(errno);
+ PLOG(ERROR) << "Failed to listen on domain socket";
origin_task_runner_->PostTask(
FROM_HERE, base::Bind(&IPCHandlerLinux::ShutDownOnOriginThread, this));
return;
@@ -158,7 +158,7 @@
while (keep_running_.load()) {
int client_socket = accept4(socket_.get(), nullptr, nullptr, SOCK_NONBLOCK);
if (client_socket < 0) {
- LOG(ERROR) << "Failed to accept client connection: " << strerror(errno);
+ PLOG(ERROR) << "Failed to accept client connection";
continue;
}