tree-wide: reopen log after fork when needed

This follows up on 0b1f3c768c, adding more places
where we should reopen the log after forking with FORK_CLOSE_ALL_FDS.

When immediately calling exec in the child, prefer to explicitly reopen the log
after exec fails. In other cases, just use FORK_REOPEN_LOG.
This commit is contained in:
Sergey Bugaev
2021-03-22 19:34:07 +03:00
parent 0e557eef37
commit 7e0ed2e9a2
5 changed files with 14 additions and 5 deletions
+1
View File
@@ -1287,6 +1287,7 @@ static int run_fsck(const char *node, const char *fstype) {
if (r == 0) {
/* Child */
execl("/sbin/fsck", "/sbin/fsck", "-aT", node, NULL);
log_open();
log_debug_errno(errno, "Failed to execl() fsck: %m");
_exit(FSCK_OPERATIONAL_ERROR);
}