summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLaurent Bercot <ska-skaware@skarnet.org>2017-08-23 08:52:28 +0000
committerLaurent Bercot <ska-skaware@skarnet.org>2017-08-23 08:52:28 +0000
commit3c8d5a7ca791a847112633c5778badfeb14bf4e8 (patch)
tree1c639c9814f8e78bc1e812df267612937265f775
parent3af45453ce8370a6a9ba974c8150cb492f1d4b22 (diff)
downloadskalibs-3c8d5a7ca791a847112633c5778badfeb14bf4e8.tar.xz
Change xexecvep exit codes ; add namespaces sysdep
-rwxr-xr-xconfigure1
-rw-r--r--src/libstddjb/xexecvep.c3
-rw-r--r--src/sysdeps/trynamespaces.c12
3 files changed, 15 insertions, 1 deletions
diff --git a/configure b/configure
index 53d5cd6..736b068 100755
--- a/configure
+++ b/configure
@@ -513,6 +513,7 @@ EOF
choose cl arc4random_addrandom ARC4RANDOM_ADDRANDOM 'arc4random_addrandom()'
choose clr getrandom GETRANDOM 'getrandom()'
choose cl itimer ITIMER 'setitimer()'
+ choose cl namespaces NAMESPACES 'namespaces'
echo '#endif' >> $sysdeps/sysdeps.h
fi
diff --git a/src/libstddjb/xexecvep.c b/src/libstddjb/xexecvep.c
index 3a3363e..294f959 100644
--- a/src/libstddjb/xexecvep.c
+++ b/src/libstddjb/xexecvep.c
@@ -1,10 +1,11 @@
/* ISC license. */
+#include <errno.h>
#include <skalibs/djbunix.h>
#include <skalibs/strerr2.h>
void xexecvep (char const *file, char const *const *argv, char const *const *envp, char const *path)
{
execvep(file, argv, envp, path) ;
- strerr_dieexec(111, file) ;
+ strerr_dieexec(errno == ENOENT ? 127 : 126, file) ;
}
diff --git a/src/sysdeps/trynamespaces.c b/src/sysdeps/trynamespaces.c
new file mode 100644
index 0000000..01894be
--- /dev/null
+++ b/src/sysdeps/trynamespaces.c
@@ -0,0 +1,12 @@
+/* ISC license. */
+
+#ifndef _GNU_SOURCE
+#define _GNU_SOURCE
+#endif
+
+#include <sched.h>
+
+int main (void)
+{
+ return unshare(0) ;
+}