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:
@@ -1223,6 +1223,7 @@ int safe_fork_full(
|
||||
/* Close the logs if requested, before we log anything. And make sure we reopen it if needed. */
|
||||
log_close();
|
||||
log_set_open_when_needed(true);
|
||||
log_settle_target();
|
||||
}
|
||||
|
||||
if (name) {
|
||||
|
||||
Reference in New Issue
Block a user