summaryrefslogtreecommitdiff
path: root/src/journal
diff options
context:
space:
mode:
Diffstat (limited to 'src/journal')
-rw-r--r--src/journal/journald-server.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/journal/journald-server.c b/src/journal/journald-server.c
index ec9be65575..12a46e6bd0 100644
--- a/src/journal/journald-server.c
+++ b/src/journal/journald-server.c
@@ -601,8 +601,15 @@ static void dispatch_message_real(
if (cg_pid_get_unit(ucred->pid, &t) >= 0) {
unit = strappend("_SYSTEMD_UNIT=", t);
free(t);
- } else if (unit_id)
- unit = strappend("_SYSTEMD_UNIT=", unit_id);
+ } else if (cg_pid_get_user_unit(ucred->pid, &t) >= 0) {
+ unit = strappend("_SYSTEMD_USER_UNIT=", t);
+ free(t);
+ } else if (unit_id) {
+ if (session)
+ unit = strappend("_SYSTEMD_USER_UNIT=", unit_id);
+ else
+ unit = strappend("_SYSTEMD_UNIT=", unit_id);
+ }
if (unit)
IOVEC_SET_STRING(iovec[n++], unit);