]> git.ipfire.org Git - thirdparty/systemd.git/commit
exec-invoke: don't double-close FDs on error
authorLuca Boccassi <bluca@debian.org>
Fri, 27 Oct 2023 15:33:49 +0000 (16:33 +0100)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Sat, 28 Oct 2023 14:56:25 +0000 (16:56 +0200)
commit7b6d3dcdd202ab8ae0478edef6eb6fa9a5437a4b
tree914972424d5cc4255023dd0a7c6247803e3a0b73
parentf756bcdf17915ffb3b8e3e21b4aa2b53ccaaac1a
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.
src/core/dynamic-user.c
src/core/dynamic-user.h
src/core/exec-invoke.c
test/units/testsuite-07.exec-context.sh