summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorElliott Hughes <enh@google.com>2013-01-10 16:01:59 -0800
committerSteve Kondik <shade@chemlab.org>2013-02-15 10:02:22 -0800
commit188935c45f951cbcfdd56ad594d3d303f139188b (patch)
treea68b90541072a268ad21daa772e043e66b7615c7
parentc08dcd9792c80393d5f8f9143a3463af846227fa (diff)
downloadbionic-188935c45f951cbcfdd56ad594d3d303f139188b.zip
bionic-188935c45f951cbcfdd56ad594d3d303f139188b.tar.gz
bionic-188935c45f951cbcfdd56ad594d3d303f139188b.tar.bz2
glibc 2.15 treats errno as signed in strerror(3).
And the only reason I hadn't done that in bionic is because I wanted to behave the same as glibc. Change-Id: I2cf1bf0aac82a748cd6305a2cabbac0790058570
-rw-r--r--libc/bionic/strerror_r.cpp2
-rw-r--r--tests/string_test.cpp2
2 files changed, 2 insertions, 2 deletions
diff --git a/libc/bionic/strerror_r.cpp b/libc/bionic/strerror_r.cpp
index e6a3975..646cc52 100644
--- a/libc/bionic/strerror_r.cpp
+++ b/libc/bionic/strerror_r.cpp
@@ -49,7 +49,7 @@ int strerror_r(int error_number, char* buf, size_t buf_len) {
if (error_name != NULL) {
length = snprintf(buf, buf_len, "%s", error_name);
} else {
- length = snprintf(buf, buf_len, "Unknown error %u", error_number);
+ length = snprintf(buf, buf_len, "Unknown error %d", error_number);
}
if (length >= buf_len) {
errno = ERANGE;
diff --git a/tests/string_test.cpp b/tests/string_test.cpp
index ab9b7e6..c7fa3d2 100644
--- a/tests/string_test.cpp
+++ b/tests/string_test.cpp
@@ -39,7 +39,7 @@ TEST(string, strerror) {
ASSERT_STREQ("Operation not permitted", strerror(1));
// Invalid.
- ASSERT_STREQ("Unknown error 4294967295", strerror(-1));
+ ASSERT_STREQ("Unknown error -1", strerror(-1));
ASSERT_STREQ("Unknown error 1234", strerror(1234));
}