aboutsummaryrefslogtreecommitdiffstats
path: root/libc/bionic/getauxval.cpp
diff options
context:
space:
mode:
authorDaniel Micay <danielmicay@gmail.com>2015-03-15 21:39:25 -0400
committerDaniel Micay <danielmicay@gmail.com>2015-03-17 19:50:55 -0400
commitee7649c5ac5f1e56cc8193cd4cee73004c04893d (patch)
treea7267fa3a7635c394f47fd409ad11058a6f4df3b /libc/bionic/getauxval.cpp
parentd917b20b613fd51e5f1056c8648fe8769ae8161e (diff)
downloadandroid_bionic-ee7649c5ac5f1e56cc8193cd4cee73004c04893d.tar.gz
android_bionic-ee7649c5ac5f1e56cc8193cd4cee73004c04893d.tar.bz2
android_bionic-ee7649c5ac5f1e56cc8193cd4cee73004c04893d.zip
set errno to ENOENT in getauxval per glibc 2.19
Bionic's getauxval(...) implementation returns zero when entries are missing. Zero can be a valid value, so there is no unambiguous way of detecting an error. Since glibc 2.19, errno is set to ENOENT when an entry is missing to make it possible to detect this. Bionic should match this behavior as code in the Linux ecosystem will start relying on it to check for the presence of newly added entries. Change-Id: Ic1efe29bc45fc87489274c96c4d2193f3a7b8854 Signed-off-by: Daniel Micay <danielmicay@gmail.com>
Diffstat (limited to 'libc/bionic/getauxval.cpp')
-rw-r--r--libc/bionic/getauxval.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/libc/bionic/getauxval.cpp b/libc/bionic/getauxval.cpp
index bc4182496..22922b942 100644
--- a/libc/bionic/getauxval.cpp
+++ b/libc/bionic/getauxval.cpp
@@ -31,6 +31,7 @@
#include <sys/auxv.h>
#include <private/bionic_auxv.h>
#include <elf.h>
+#include <errno.h>
__LIBC_HIDDEN__ ElfW(auxv_t)* __libc_auxv = NULL;
@@ -40,5 +41,6 @@ extern "C" unsigned long int getauxval(unsigned long int type) {
return v->a_un.a_val;
}
}
+ errno = ENOENT;
return 0;
}