chiark / gitweb /
tree-wide: reopen log when we need to log in FORK_CLOSE_ALL_FDS children
authorLennart Poettering <lennart@poettering.net>
Wed, 21 Feb 2018 23:35:00 +0000 (00:35 +0100)
committerSven Eden <yamakuzure@gmx.net>
Wed, 30 May 2018 05:59:02 +0000 (07:59 +0200)
commit4809beb5fe6a0651b46a3663a9e12a65dd7f451d
tree9c8d26c4c8fc0bcefce6139bc73bc416a0fdc4fa
parent8b1de0ce2cd30cf60f8129c84b4ea64e612e97eb
tree-wide: reopen log when we need to log in FORK_CLOSE_ALL_FDS children

In a number of occasions we use FORK_CLOSE_ALL_FDS when forking off a
child, since we don't want to pass fds to the processes spawned (either
because we later want to execve() some other process there, or because
our child might hang around for longer than expected, in which case it
shouldn't keep our fd pinned). This also closes any logging fds, and
thus means logging is turned off in the child. If we want to do proper
logging, explicitly reopen the logs hence in the child at the right
time.

This is particularly crucial in the umount/remount children we fork off
the shutdown binary, as otherwise the children can't log, which is
why #8155 is harder to debug than necessary: the log messages we
generate about failing mount() system calls aren't actually visible on
screen, as they done in the child processes where the log fds are
closed.
src/login/inhibit.c