summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorElliott Hughes2015-06-30 10:22:24 -0500
committerElliott Hughes2015-06-30 12:41:15 -0500
commit6ed68cc412752e4c78755df9a1516e610ec66fa8 (patch)
tree287929b99130bf3a06b67b5abf2d3b4b6d8199f3 /libutils/Tokenizer.cpp
parent692dc75d9fbf5c256cd8c66219a930ae0fe9f523 (diff)
downloadplatform-system-core-6ed68cc412752e4c78755df9a1516e610ec66fa8.tar.gz
platform-system-core-6ed68cc412752e4c78755df9a1516e610ec66fa8.tar.xz
platform-system-core-6ed68cc412752e4c78755df9a1516e610ec66fa8.zip
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
Diffstat (limited to 'libutils/Tokenizer.cpp')
-rw-r--r--libutils/Tokenizer.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/libutils/Tokenizer.cpp b/libutils/Tokenizer.cpp
index 610002fe3..2d0e83dcd 100644
--- a/libutils/Tokenizer.cpp
+++ b/libutils/Tokenizer.cpp
@@ -56,12 +56,12 @@ status_t Tokenizer::open(const String8& filename, Tokenizer** outTokenizer) {
56 int fd = ::open(filename.string(), O_RDONLY); 56 int fd = ::open(filename.string(), O_RDONLY);
57 if (fd < 0) { 57 if (fd < 0) {
58 result = -errno; 58 result = -errno;
59 ALOGE("Error opening file '%s', %s.", filename.string(), strerror(errno)); 59 ALOGE("Error opening file '%s': %s", filename.string(), strerror(errno));
60 } else { 60 } else {
61 struct stat stat; 61 struct stat stat;
62 if (fstat(fd, &stat)) { 62 if (fstat(fd, &stat)) {
63 result = -errno; 63 result = -errno;
64 ALOGE("Error getting size of file '%s', %s.", filename.string(), strerror(errno)); 64 ALOGE("Error getting size of file '%s': %s", filename.string(), strerror(errno));
65 } else { 65 } else {
66 size_t length = size_t(stat.st_size); 66 size_t length = size_t(stat.st_size);
67 67
@@ -83,7 +83,7 @@ status_t Tokenizer::open(const String8& filename, Tokenizer** outTokenizer) {
83 ssize_t nrd = read(fd, buffer, length); 83 ssize_t nrd = read(fd, buffer, length);
84 if (nrd < 0) { 84 if (nrd < 0) {
85 result = -errno; 85 result = -errno;
86 ALOGE("Error reading file '%s', %s.", filename.string(), strerror(errno)); 86 ALOGE("Error reading file '%s': %s", filename.string(), strerror(errno));
87 delete[] buffer; 87 delete[] buffer;
88 buffer = NULL; 88 buffer = NULL;
89 } else { 89 } else {