Fix sysconf errno for unknown names.
The code (and comment) have been like this since the initial commit, but
there was never a test of this, and glibc seems to have been returning
EINVAL (as POSIX says it should) since long before Android existed.
Bug: http://b/31154352
Test: ran tests
Change-Id: Ica1ea836a4a5699ef0d956fe9c0f322e567de34d
diff --git a/libc/bionic/sysconf.cpp b/libc/bionic/sysconf.cpp
index 2442fd9..2b3200c 100644
--- a/libc/bionic/sysconf.cpp
+++ b/libc/bionic/sysconf.cpp
@@ -221,9 +221,7 @@
case _SC_LEVEL4_CACHE_LINESIZE: return 0;
default:
- // Posix says EINVAL is the only error that shall be returned,
- // but glibc uses ENOSYS.
- errno = ENOSYS;
+ errno = EINVAL;
return -1;
}
}