13
0

Close stderr of child processes on MacOS

This fixes a bug on some modern mac systems. Related to
setup_logging() changing stderr to use ASL and write to com.apple.console.

When a forked application writes to stderr while ASL is used,
the child is terminated for some reason.
This commit is contained in:
Robin Gareus 2019-03-05 19:11:10 +01:00
parent a390d8d3ca
commit 8b5437301b
Signed by: rgareus
GPG Key ID: A090BCE02CF57F04

View File

@ -897,8 +897,11 @@ SystemExec::start (StdErrMode stderr_mode, const char *vfork_exec_wrapper)
} else if (stderr_mode == IgnoreAndClose) {
/* ignore STDERR */
::close(STDERR_FILENO);
} else {
} else { /* stderr_mode == ShareWithParent */
/* keep STDERR */
#if defined __APPLE__&& defined ASL_LOG_DESCRIPTOR_WRITE
::close(STDERR_FILENO);
#endif
}
if (pout[1] != STDOUT_FILENO && pout[1] != STDERR_FILENO) {