mirror of
https://github.com/morgan9e/systemd
synced 2026-04-15 17:06:39 +09:00
core: Settle log target if we're going to be closing all fds
Whenever we're going to close all file descriptors, we tend to close the log and set it into open when needed mode. When this is done with the logging target set to LOG_TARGET_AUTO, we run into issues because for every logging call, we'll check if stderr is connected to the journal to determine where to send the logging message. This check obviously stops working when we close stderr, so we settle the log target before we do that so that we keep using the same logging target even after stderr is closed.
This commit is contained in:
@@ -3551,6 +3551,7 @@ static int inner_child(
|
||||
* it again. Note that the other fds closed here are at least the locking and barrier fds. */
|
||||
log_close();
|
||||
log_set_open_when_needed(true);
|
||||
log_settle_target();
|
||||
|
||||
(void) fdset_close_others(fds);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user