diff options
author | Lennart Poettering <lennart@poettering.net> | 2018-07-17 11:47:14 +0200 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2018-07-25 22:48:11 +0200 |
commit | 5686391b006ee82d8a4559067ad9818e3e631247 (patch) | |
tree | 2d5bcfcf0838a3abd120bde1a7145acf2492b3b6 /src/core/dbus-scope.c | |
parent | execute: use our usual syntax for defining bit masks (diff) | |
download | systemd-5686391b006ee82d8a4559067ad9818e3e631247.tar.xz systemd-5686391b006ee82d8a4559067ad9818e3e631247.zip |
core: introduce new Type=exec service type
Users are often surprised that "systemd-run" command lines like
"systemd-run -p User=idontexist /bin/true" will return successfully,
even though the logs show that the process couldn't be invoked, as the
user "idontexist" doesn't exist. This is because Type=simple will only
wait until fork() succeeded before returning start-up success.
This patch adds a new service type Type=exec, which is very similar to
Type=simple, but waits until the child process completed the execve()
before returning success. It uses a pipe that has O_CLOEXEC set for this
logic, so that the kernel automatically sends POLLHUP on it when the
execve() succeeded but leaves the pipe open if not. This means PID 1
waits exactly until the execve() succeeded in the child, and not longer
and not shorter, which is the desired functionality.
Making use of this new functionality, the command line
"systemd-run -p User=idontexist -p Type=exec /bin/true" will now fail,
as expected.
Diffstat (limited to '')
0 files changed, 0 insertions, 0 deletions