Always use strerror to report errno.
Change-Id: Icd18e4bd7dc093c18967f45b99cd451359457b03
diff --git a/init/builtins.cpp b/init/builtins.cpp
index e659cfa..6daea37 100644
--- a/init/builtins.cpp
+++ b/init/builtins.cpp
@@ -475,7 +475,7 @@
int wp_ret = TEMP_FAILURE_RETRY(waitpid(pid, &status, 0));
if (wp_ret < 0) {
/* Unexpected error code. We will continue anyway. */
- NOTICE("waitpid failed rc=%d, errno=%d\n", wp_ret, errno);
+ NOTICE("waitpid failed rc=%d: %s\n", wp_ret, strerror(errno));
}
if (WIFEXITED(status)) {
diff --git a/init/devices.cpp b/init/devices.cpp
index aa86e5f..9bce39a 100644
--- a/init/devices.cpp
+++ b/init/devices.cpp
@@ -871,7 +871,7 @@
booting = is_booting();
goto try_loading_again;
}
- INFO("firmware: could not open '%s' %d\n", uevent->firmware, errno);
+ INFO("firmware: could not open '%s': %s\n", uevent->firmware, strerror(errno));
write(loading_fd, "-1", 2);
goto data_close_out;
}
diff --git a/init/keychords.cpp b/init/keychords.cpp
index d6464bd..2e996ea 100644
--- a/init/keychords.cpp
+++ b/init/keychords.cpp
@@ -80,7 +80,7 @@
ret = write(fd, keychords, keychords_length);
if (ret != keychords_length) {
- ERROR("could not configure /dev/keychord %d (%d)\n", ret, errno);
+ ERROR("could not configure /dev/keychord %d: %s\n", ret, strerror(errno));
close(fd);
fd = -1;
}
diff --git a/init/property_service.cpp b/init/property_service.cpp
index 2031aae..0e03a1d 100644
--- a/init/property_service.cpp
+++ b/init/property_service.cpp
@@ -161,7 +161,7 @@
snprintf(tempPath, sizeof(tempPath), "%s/.temp.XXXXXX", PERSISTENT_PROPERTY_DIR);
fd = mkstemp(tempPath);
if (fd < 0) {
- ERROR("Unable to write persistent property to temp file %s errno: %d\n", tempPath, errno);
+ ERROR("Unable to write persistent property to temp file %s: %s\n", tempPath, strerror(errno));
return;
}
write(fd, value, strlen(value));
@@ -289,15 +289,15 @@
close(s);
return;
} else if (nr < 0) {
- ERROR("sys_prop: error waiting for uid=%d to send property message. err=%d %s\n", cr.uid, errno, strerror(errno));
+ ERROR("sys_prop: error waiting for uid=%d to send property message: %s\n", cr.uid, strerror(errno));
close(s);
return;
}
r = TEMP_FAILURE_RETRY(recv(s, &msg, sizeof(msg), MSG_DONTWAIT));
if(r != sizeof(prop_msg)) {
- ERROR("sys_prop: mis-match msg size received: %d expected: %zu errno: %d\n",
- r, sizeof(prop_msg), errno);
+ ERROR("sys_prop: mis-match msg size received: %d expected: %zu: %s\n",
+ r, sizeof(prop_msg), strerror(errno));
close(s);
return;
}