commit 563670ff4bb6c50a91aa31427078515a85a92ce3
parent ea189862e2be9ebf35da6174b1ae0083a22cc9ee
Author: Laurent Bercot <ska-skaware@skarnet.org>
Date: Mon, 14 Dec 2020 13:30:20 +0000
Add chroot sysdep, fix endianness sysdep string in .h
Diffstat:
3 files changed, 22 insertions(+), 1 deletion(-)
diff --git 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
@@ -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
@@ -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