summaryrefslogtreecommitdiff
path: root/src/sysdeps/trychroot.c
diff options
context:
space:
mode:
authorLaurent Bercot <ska-skaware@skarnet.org>2020-12-14 13:30:20 +0000
committerLaurent Bercot <ska-skaware@skarnet.org>2020-12-14 13:30:20 +0000
commit563670ff4bb6c50a91aa31427078515a85a92ce3 (patch)
tree32c32d5972d5547abededb07567522eae5c8b405 /src/sysdeps/trychroot.c
parentea189862e2be9ebf35da6174b1ae0083a22cc9ee (diff)
downloadskalibs-563670ff4bb6c50a91aa31427078515a85a92ce3.tar.xz
Add chroot sysdep, fix endianness sysdep string in .h
Diffstat (limited to 'src/sysdeps/trychroot.c')
-rw-r--r--src/sysdeps/trychroot.c20
1 files changed, 20 insertions, 0 deletions
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 ;
+}