summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--config/confstr.c9
-rw-r--r--config/header.mk1
-rw-r--r--src/bfstd.c10
3 files changed, 15 insertions, 5 deletions
diff --git a/config/confstr.c b/config/confstr.c
new file mode 100644
index 0000000..58280b4
--- /dev/null
+++ b/config/confstr.c
@@ -0,0 +1,9 @@
+// Copyright © Tavian Barnes <tavianator@tavianator.com>
+// SPDX-License-Identifier: 0BSD
+
+#include <unistd.h>
+
+int main(void) {
+ confstr(_CS_PATH, NULL, 0);
+ return 0;
+}
diff --git a/config/header.mk b/config/header.mk
index cc4ae05..b6915d5 100644
--- a/config/header.mk
+++ b/config/header.mk
@@ -9,6 +9,7 @@ include config/exports.mk
# All header fragments we generate
HEADERS := \
+ ${GEN}/confstr.h \
${GEN}/getdents.h \
${GEN}/getdents64.h \
${GEN}/getdents64-syscall.h \
diff --git a/src/bfstd.c b/src/bfstd.c
index e8a927a..3eff024 100644
--- a/src/bfstd.c
+++ b/src/bfstd.c
@@ -581,10 +581,7 @@ int xfaccessat(int fd, const char *path, int amode) {
}
char *xconfstr(int name) {
-#if __ANDROID__
- errno = ENOTSUP;
- return NULL;
-#else
+#if BFS_HAS_CONFSTR
size_t len = confstr(name, NULL, 0);
if (len == 0) {
return NULL;
@@ -601,7 +598,10 @@ char *xconfstr(int name) {
}
return str;
-#endif // !__ANDROID__
+#else
+ errno = ENOTSUP;
+ return NULL;
+#endif
}
char *xreadlinkat(int fd, const char *path, size_t size) {