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/tests/string_posix_strerror_r_test.cpp b/tests/string_posix_strerror_r_test.cpp
index 596684b..67b3c1f 100644
--- a/tests/string_posix_strerror_r_test.cpp
+++ b/tests/string_posix_strerror_r_test.cpp
@@ -55,10 +55,10 @@
// Buffer too small.
errno = 0;
memset(buf, 0, sizeof(buf));
- ASSERT_EQ(-1, strerror_r(4567, buf, 2));
- ASSERT_STREQ("U", buf);
- // The POSIX strerror_r sets errno to ERANGE (the GNU one doesn't).
- ASSERT_EQ(ERANGE, errno);
+ ASSERT_EQ(ERANGE, strerror_r(EPERM, buf, 2));
+ ASSERT_STREQ("O", buf);
+ // POSIX strerror_r returns an error without updating errno.
+ ASSERT_EQ(0, errno);
}
#endif