summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xconfigure1
-rw-r--r--src/sysdeps/trychroot.c20
-rwxr-xr-xtools/gen-sysdepsh.sh2
3 files changed, 22 insertions, 1 deletions
diff --git a/configure b/configure
index dec5e15..0376555 100755
--- a/configure
+++ b/configure
@@ -636,6 +636,7 @@ choose cl namespaces 'namespaces'
choose cl nsgetparent 'NS_GET_PARENT'
choose cl explicit_bzero 'explicit_bzero()'
choose cl getrandom 'getrandom()'
+choose cl chroot 'chroot()'
# Here are the evil irreducible run-time sysdeps.
choose clr devurandom '/dev/urandom'
diff --git a/src/sysdeps/trychroot.c b/src/sysdeps/trychroot.c
new file mode 100644
index 0000000..42d8872
--- /dev/null
+++ b/src/sysdeps/trychroot.c
@@ -0,0 +1,20 @@
+/* ISC license. */
+
+#undef _POSIX_C_SOURCE
+#undef _XOPEN_SOURCE
+
+#ifndef _BSD_SOURCE
+#define _BSD_SOURCE
+#endif
+
+#ifndef _DEFAULT_SOURCE
+#define _DEFAULT_SOURCE
+#endif
+
+#include <unistd.h>
+
+int main (void)
+{
+ if (chroot("/") < 0) return 1 ;
+ return 0 ;
+}
diff --git a/tools/gen-sysdepsh.sh b/tools/gen-sysdepsh.sh
index fc9ccbd..8373f8f 100755
--- a/tools/gen-sysdepsh.sh
+++ b/tools/gen-sysdepsh.sh
@@ -26,7 +26,7 @@ while read k v ; do
echo "#define SKALIBS_$k $v"
elif test ${k} = ENDIANNESS ; then
echo '#undef SKALIBS_ENDIANNESS'
- echo "#define SKALIBS_ENDIANNESS $v"
+ echo "#define SKALIBS_ENDIANNESS \"$v\""
else
echo "#undef SKALIBS_HAS$k"
if test $v = yes ; then