X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=src%2Fshared%2Flog.c;h=85c0605bd547e53d73f5b777eaafd06207a263ef;hb=2a7a7d0b0f645b14cf0388b40d747b0ccb0c091e;hp=03ef018bd4b870268806f8e2e890180236407c00;hpb=5e07a79e84ab8b045b9df1a2719f14fc84471a1d;p=elogind.git diff --git a/src/shared/log.c b/src/shared/log.c index 03ef018bd..85c0605bd 100644 --- a/src/shared/log.c +++ b/src/shared/log.c @@ -34,6 +34,9 @@ #include "missing.h" #include "macro.h" #include "socket-util.h" +#include "formats-util.h" +#include "process-util.h" +#include "terminal-util.h" #define SNDBUF_SIZE (8*1024*1024) @@ -949,7 +952,11 @@ static int parse_proc_cmdline_item(const char *key, const char *value) { void log_parse_environment(void) { const char *e; - (void) parse_proc_cmdline(parse_proc_cmdline_item); + if (get_ctty_devnr(0, NULL) < 0) + /* Only try to read the command line in daemons. + We assume that anything that has a controlling + tty is user stuff. */ + (void) parse_proc_cmdline(parse_proc_cmdline_item); e = secure_getenv("SYSTEMD_LOG_TARGET"); if (e && log_set_target_from_string(e) < 0)