chiark / gitweb /
systemctl: Fix wrong assertion test
[elogind.git] / src / journal / journald-server.c
index 60e5a913a77c52fd06301c659e025c5fcfb83caf..12a46e6bd0d3a4fd50be651fecf409e3576d4f3b 100644 (file)
@@ -556,7 +556,7 @@ static void dispatch_message_real(
                                 IOVEC_SET_STRING(iovec[n++], exe);
                 }
 
-                r = get_process_cmdline(ucred->pid, LINE_MAX, false, &t);
+                r = get_process_cmdline(ucred->pid, 0, false, &t);
                 if (r >= 0) {
                         cmdline = strappend("_CMDLINE=", t);
                         free(t);
@@ -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);