diff --git a/libc/bionic/strerror_r.cpp b/libc/bionic/strerror_r.cpp index e6a39754e..646cc5239 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 71998d877..d55771cf6 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)); }