summaryrefslogtreecommitdiffstats
path: root/src/core/execute.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2017-07-14 18:59:41 +0200
committerLennart Poettering <lennart@poettering.net>2017-07-31 18:01:42 +0200
commitc867611e0a123b81c890c7ee952b2944646d7f91 (patch)
tree826ab6c351ab638cddf5cb6e5200725770d56500 /src/core/execute.c
parentexecute: make some code shorter (diff)
downloadsystemd-c867611e0a123b81c890c7ee952b2944646d7f91.tar.xz
systemd-c867611e0a123b81c890c7ee952b2944646d7f91.zip
execute: don't pass unit ID in --user mode to journald for stream logging
When we create a log stream connection to journald, we pass along the unit ID. With this change we do this only when we run as system instance, not as user instance, to remove the ambiguity whether a user or system unit is specified. The effect of this change is minor: journald ignores the field anyway from clients with UID != 0. This patch hence only fixes the unit attribution for the --user instance of the root user.
Diffstat (limited to '')
-rw-r--r--src/core/execute.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/core/execute.c b/src/core/execute.c
index b76b9b9e6f..7481588b08 100644
--- a/src/core/execute.c
+++ b/src/core/execute.c
@@ -356,8 +356,8 @@ static int connect_logger_as(
"%i\n"
"%i\n"
"%i\n",
- context->syslog_identifier ? context->syslog_identifier : ident,
- unit->id,
+ context->syslog_identifier ?: ident,
+ MANAGER_IS_SYSTEM(unit->manager) ? unit->id : "",
context->syslog_priority,
!!context->syslog_level_prefix,
output == EXEC_OUTPUT_SYSLOG || output == EXEC_OUTPUT_SYSLOG_AND_CONSOLE,