summaryrefslogtreecommitdiff
path: root/src/journal/journald-server.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2013-07-19 19:52:30 +0200
committerLennart Poettering <lennart@poettering.net>2013-07-19 19:52:30 +0200
commit19cace379f3f680d3201cd257ab3ca6708b2d45d (patch)
tree7fcf20a9dff11225490975dfd28d3a93d5803720 /src/journal/journald-server.c
parent83787333bd75f3fb5d2d844a5d5dbf68d93f7f3f (diff)
journald: after the cgroup rework processes may be in both user and system units at the same time
Diffstat (limited to 'src/journal/journald-server.c')
-rw-r--r--src/journal/journald-server.c31
1 files changed, 16 insertions, 15 deletions
diff --git a/src/journal/journald-server.c b/src/journal/journald-server.c
index 81de959666..60c32b1eff 100644
--- a/src/journal/journald-server.c
+++ b/src/journal/journald-server.c
@@ -623,19 +623,20 @@ static void dispatch_message_real(
if (cg_path_get_unit(c, &t) >= 0) {
x = strappenda("_SYSTEMD_UNIT=", t);
free(t);
- } else if (cg_path_get_user_unit(c, &t) >= 0) {
+ IOVEC_SET_STRING(iovec[n++], x);
+ } else if (unit_id && !session) {
+ x = strappenda("_SYSTEMD_UNIT=", unit_id);
+ IOVEC_SET_STRING(iovec[n++], x);
+ }
+
+ if (cg_path_get_user_unit(c, &t) >= 0) {
x = strappenda("_SYSTEMD_USER_UNIT=", t);
free(t);
- } else if (unit_id) {
- if (session)
- x = strappenda("_SYSTEMD_USER_UNIT=", unit_id);
- else
- x = strappenda("_SYSTEMD_UNIT=", unit_id);
- } else
- x = NULL;
-
- if (x)
IOVEC_SET_STRING(iovec[n++], x);
+ } else if (unit_id && session) {
+ x = strappenda("_SYSTEMD_USER_UNIT=", unit_id);
+ IOVEC_SET_STRING(iovec[n++], x);
+ }
free(c);
}
@@ -728,14 +729,14 @@ static void dispatch_message_real(
if (cg_path_get_unit(c, &t) >= 0) {
x = strappenda("OBJECT_SYSTEMD_UNIT=", t);
free(t);
- } else if (cg_path_get_user_unit(c, &t) >= 0) {
+ IOVEC_SET_STRING(iovec[n++], x);
+ }
+
+ if (cg_path_get_user_unit(c, &t) >= 0) {
x = strappenda("OBJECT_SYSTEMD_USER_UNIT=", t);
free(t);
- } else
- x = NULL;
-
- if (x)
IOVEC_SET_STRING(iovec[n++], x);
+ }
free(c);
}