summaryrefslogtreecommitdiff
path: root/src/core/main.c
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2017-02-21 17:35:01 -0500
committerGitHub <noreply@github.com>2017-02-21 17:35:01 -0500
commit5978bdd05fed013d301f6d8b089c7c7ea8c0ef8e (patch)
tree676c5bd2a479a80cbce71ba02c1ada8883989540 /src/core/main.c
parenta3d8d68cc1698d014575f0f66c58e253bd46c240 (diff)
parentbcab914f7fb0570eb728907163ada55c6ae3d602 (diff)
Merge pull request #5411 from poettering/various-pre-v233-fixes
Various pre v233 fixes.
Diffstat (limited to 'src/core/main.c')
-rw-r--r--src/core/main.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/core/main.c b/src/core/main.c
index 3c6b18229c..bcf9ea5f25 100644
--- a/src/core/main.c
+++ b/src/core/main.c
@@ -1414,10 +1414,17 @@ int main(int argc, char *argv[]) {
log_set_upgrade_syslog_to_journal(true);
- /* Disable the umask logic */
- if (getpid() == 1)
+ if (getpid() == 1) {
+ /* Disable the umask logic */
umask(0);
+ /* Always reopen /dev/console when running as PID 1 or one of its pre-execve() children. This is
+ * important so that we never end up logging to any foreign stderr, for example if we have to log in a
+ * child process right before execve()'ing the actual binary, at a point in time where socket
+ * activation stderr/stdout area already set up. */
+ log_set_always_reopen_console(true);
+ }
+
if (getpid() == 1 && detect_container() <= 0) {
/* Running outside of a container as PID 1 */