summaryrefslogtreecommitdiff
path: root/meson.build
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2020-09-23 16:23:30 +0200
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2020-11-06 15:20:34 +0100
commit8939eeae528ef9b9ad2a21995279b76d382d5c81 (patch)
treebb18c4c23b36911c87d09c1c69c80ada5c707104 /meson.build
parenta6d9111c67264a8828a563ccc23a24144b879942 (diff)
downloadsystemd-8939eeae528ef9b9ad2a21995279b76d382d5c81.tar.gz
shared/exec-util: use our own execveat() wrapper instead of fexecve()
For scripts, when we call fexecve(), on new kernels glibc calls execveat(), which fails with ENOENT, and then we fall back to execve() which succeeds: [pid 63039] execveat(3, "", ["/home/zbyszek/src/systemd/test/test-path-util/script.sh", "--version"], 0x7ffefa3633f0 /* 0 vars */, AT_EMPTY_PATH) = -1 ENOENT (No such file or directory) [pid 63039] execve("/home/zbyszek/src/systemd/test/test-path-util/script.sh", ["/home/zbyszek/src/systemd/test/test-path-util/script.sh", "--version"], 0x7ffefa3633f0 /* 0 vars */) = 0 But on older kernels glibc (some versions?) implement a fallback which falls into the same trap with bash $0: [pid 13534] execve("/proc/self/fd/3", ["/home/test/systemd/test/test-path-util/script.sh", "--version"], 0x7fff84995870 /* 0 vars */) = 0 We don't want that, so let's call execveat() ourselves. Then we can do the execve() fallback as we want.
Diffstat (limited to 'meson.build')
-rw-r--r--meson.build1
1 files changed, 1 insertions, 0 deletions
diff --git a/meson.build b/meson.build
index 04cb63d921..68ead1f849 100644
--- a/meson.build
+++ b/meson.build
@@ -533,6 +533,7 @@ foreach ident : [
#include <signal.h>
#include <sys/wait.h>'''],
['mallinfo', '''#include <malloc.h>'''],
+ ['execveat', '''#include <unistd.h>'''],
['close_range', '''#include <unistd.h>'''],
]