summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSamuel Holland <samuel@sholland.org>2018-09-11 22:20:17 -0500
committerSamuel Holland <samuel@sholland.org>2018-09-11 22:50:44 -0500
commit71d20ba411d3923934409936ba20f6ead8a6cbcd (patch)
treedce6ab75c844c7f620e022098854777b164964f8
parentfc611beda52e6063bf0510a84313d70eb033a672 (diff)
downloadgcompat-71d20ba411d3923934409936ba20f6ead8a6cbcd.tar.gz
gcompat-71d20ba411d3923934409936ba20f6ead8a6cbcd.tar.bz2
gcompat-71d20ba411d3923934409936ba20f6ead8a6cbcd.tar.xz
gcompat-71d20ba411d3923934409936ba20f6ead8a6cbcd.zip
readlink: Report ENOSYS on dlsym failure
Signed-off-by: Samuel Holland <samuel@sholland.org>
-rw-r--r--CHANGELOG.rst6
-rw-r--r--libgcompat/readlink.c2
2 files changed, 8 insertions, 0 deletions
diff --git a/CHANGELOG.rst b/CHANGELOG.rst
index f86ecdc..2a4b1d3 100644
--- a/CHANGELOG.rst
+++ b/CHANGELOG.rst
@@ -35,6 +35,12 @@ math
* Add most __*_finite functions, courtesy of Elizabeth Myers.
+readlink
+--------
+
+* Report ENOSYS on dlsym failure.
+
+
resolv
------
diff --git a/libgcompat/readlink.c b/libgcompat/readlink.c
index 63def96..0db094c 100644
--- a/libgcompat/readlink.c
+++ b/libgcompat/readlink.c
@@ -1,4 +1,5 @@
#include <dlfcn.h>
+#include <errno.h>
#include <fcntl.h>
#include <limits.h>
#include <stddef.h>
@@ -18,6 +19,7 @@ ssize_t readlink(const char *path, char *buf, size_t len)
if (real_readlink == NULL) {
real_readlink = dlsym(RTLD_NEXT, "readlink");
if (real_readlink == NULL) {
+ errno = ENOSYS;
return -1;
}
}