Consistently use strerror in libutils.
It's easier for people to debug, and side-steps the problem that errno
values differ between architectures.
Bug: http://b/17458391
Change-Id: I1db9b2cbb653839d3936b91e37e5cff02671318a
diff --git a/libutils/ProcessCallStack.cpp b/libutils/ProcessCallStack.cpp
index db07e56..011c302 100644
--- a/libutils/ProcessCallStack.cpp
+++ b/libutils/ProcessCallStack.cpp
@@ -17,9 +17,10 @@
#define LOG_TAG "ProcessCallStack"
// #define LOG_NDEBUG 0
-#include <string.h>
-#include <stdio.h>
#include <dirent.h>
+#include <errno.h>
+#include <stdio.h>
+#include <string.h>
#include <utils/Log.h>
#include <utils/Errors.h>
@@ -135,8 +136,8 @@
dp = opendir(PATH_SELF_TASK);
if (dp == NULL) {
- ALOGE("%s: Failed to update the process's call stacks (errno = %d, '%s')",
- __FUNCTION__, errno, strerror(errno));
+ ALOGE("%s: Failed to update the process's call stacks: %s",
+ __FUNCTION__, strerror(errno));
return;
}
@@ -172,8 +173,8 @@
ssize_t idx = mThreadMap.add(tid, ThreadInfo());
if (idx < 0) { // returns negative error value on error
- ALOGE("%s: Failed to add new ThreadInfo (errno = %zd, '%s')",
- __FUNCTION__, idx, strerror(-idx));
+ ALOGE("%s: Failed to add new ThreadInfo: %s",
+ __FUNCTION__, strerror(-idx));
continue;
}
@@ -195,8 +196,8 @@
__FUNCTION__, tid, threadInfo.callStack.size());
}
if (code != 0) { // returns positive error value on error
- ALOGE("%s: Failed to readdir from %s (errno = %d, '%s')",
- __FUNCTION__, PATH_SELF_TASK, -code, strerror(code));
+ ALOGE("%s: Failed to readdir from %s: %s",
+ __FUNCTION__, PATH_SELF_TASK, strerror(code));
}
#endif