diff options
author | Laurent Bercot <ska-skaware@skarnet.org> | 2020-12-14 13:30:20 +0000 |
---|---|---|
committer | Laurent Bercot <ska-skaware@skarnet.org> | 2020-12-14 13:30:20 +0000 |
commit | 563670ff4bb6c50a91aa31427078515a85a92ce3 (patch) | |
tree | 32c32d5972d5547abededb07567522eae5c8b405 | |
parent | ea189862e2be9ebf35da6174b1ae0083a22cc9ee (diff) | |
download | skalibs-563670ff4bb6c50a91aa31427078515a85a92ce3.tar.xz |
Add chroot sysdep, fix endianness sysdep string in .h
-rwxr-xr-x | configure | 1 | ||||
-rw-r--r-- | src/sysdeps/trychroot.c | 20 | ||||
-rwxr-xr-x | tools/gen-sysdepsh.sh | 2 |
3 files changed, 22 insertions, 1 deletions
@@ -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 |