POSIX strerror_r returns an error number, not -1
The posix spec says strerror_r returns a positive error number, not
-1 and set errno.
Test: bionic-unit-tests-static
Change-Id: I6a12d50d046f9caac299bf3bff63e6c9496c1b6f
diff --git a/libc/bionic/strerror.cpp b/libc/bionic/strerror.cpp
index 5733567..0deb200 100644
--- a/libc/bionic/strerror.cpp
+++ b/libc/bionic/strerror.cpp
@@ -196,8 +196,7 @@
length = async_safe_format_buffer(buf, buf_len, "Unknown error %d", error_number);
}
if (length >= buf_len) {
- errno_restorer.override(ERANGE);
- return -1;
+ return ERANGE;
}
return 0;