diff options
Diffstat (limited to 'src/shared')
-rw-r--r-- | src/shared/log.c | 5 | ||||
-rw-r--r-- | src/shared/log.h | 1 |
2 files changed, 5 insertions, 1 deletions
diff --git a/src/shared/log.c b/src/shared/log.c index da5309888c..6a10dc4540 100644 --- a/src/shared/log.c +++ b/src/shared/log.c @@ -240,7 +240,7 @@ int log_open(void) { return 0; } - if (log_target != LOG_TARGET_AUTO || + if ((log_target != LOG_TARGET_AUTO && log_target != LOG_TARGET_SAFE) || getpid() == 1 || isatty(STDERR_FILENO) <= 0) { @@ -266,6 +266,7 @@ int log_open(void) { } if (log_target == LOG_TARGET_AUTO || + log_target == LOG_TARGET_SAFE || log_target == LOG_TARGET_JOURNAL_OR_KMSG || log_target == LOG_TARGET_SYSLOG_OR_KMSG || log_target == LOG_TARGET_KMSG) { @@ -547,6 +548,7 @@ static int log_dispatch( if (k <= 0 && (log_target == LOG_TARGET_AUTO || + log_target == LOG_TARGET_SAFE || log_target == LOG_TARGET_SYSLOG_OR_KMSG || log_target == LOG_TARGET_JOURNAL_OR_KMSG || log_target == LOG_TARGET_KMSG)) { @@ -744,6 +746,7 @@ static const char *const log_target_table[] = { [LOG_TARGET_SYSLOG] = "syslog", [LOG_TARGET_SYSLOG_OR_KMSG] = "syslog-or-kmsg", [LOG_TARGET_AUTO] = "auto", + [LOG_TARGET_SAFE] = "safe", [LOG_TARGET_NULL] = "null" }; diff --git a/src/shared/log.h b/src/shared/log.h index b2f5f2a920..59d4c00f7d 100644 --- a/src/shared/log.h +++ b/src/shared/log.h @@ -36,6 +36,7 @@ typedef enum LogTarget{ LOG_TARGET_SYSLOG, LOG_TARGET_SYSLOG_OR_KMSG, LOG_TARGET_AUTO, /* console if stderr is tty, JOURNAL_OR_KMSG otherwise */ + LOG_TARGET_SAFE, /* console if stderr is tty, KMSG otherwise */ LOG_TARGET_NULL, _LOG_TARGET_MAX, _LOG_TARGET_INVALID = -1 |