exec-invoke: don't double-close FDs on error
When a late error occurs in sd-executor, the cleanup-on-close of the context structs happen, but at that time all FDs might have already been closed via close_all_fds(), so a double-close happens. This can be seen when DynamicUser is enabled, with a non-existing WorkingDirectory. Invalidate the FDs in the context structs if close_all_fds succeeds.
This commit is contained in:
committed by
Zbigniew Jędrzejewski-Szmek
parent
f756bcdf17
commit
7b6d3dcdd2
@@ -186,3 +186,6 @@ systemd-run --wait --pipe -p BindPaths="/etc /home:/mnt:norbind -/foo/bar/baz:/u
|
||||
bash -xec "mountpoint /etc; test -d /etc/systemd; mountpoint /mnt; ! mountpoint /usr"
|
||||
systemd-run --wait --pipe -p BindReadOnlyPaths="/etc /home:/mnt:norbind -/foo/bar/baz:/usr:rbind" \
|
||||
bash -xec "test ! -w /etc; test ! -w /mnt; ! mountpoint /usr"
|
||||
|
||||
# Ensure that clean-up codepaths work correctly if activation ultimately fails
|
||||
(! systemd-run --wait --pipe -p DynamicUser=yes -p WorkingDirectory=/nonexistent echo hello)
|
||||
|
||||
Reference in New Issue
Block a user