]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
systemctl: don't use get_process_comm() on non-local PIDs (#7518)
authorLennart Poettering <lennart@poettering.net>
Fri, 1 Dec 2017 10:21:58 +0000 (11:21 +0100)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Fri, 1 Dec 2017 10:21:58 +0000 (11:21 +0100)
Let's not use local process data for remote processes, that can only
show nonsense.

Maybe one day we should add a bus API to query the comm field of a
process remotely, but for now, let's not bother, the information is
redundant anyway, as the cgroup data shows it too (and the cgroup tree
is show as part of status as well, and is requested from remote through
dbus, without local kernel calls).

Fixes: #7516
src/systemctl/systemctl.c

index e52b4e32be29f908c3c7a79f201c8baf6cb1b5f6..e121d580cff79d5afb61bb1fefa1dd53c35fc8d0 100644 (file)
@@ -4245,10 +4245,15 @@ static void print_status_info(
                         printf(" Main PID: "PID_FMT, i->main_pid);
 
                         if (i->running) {
-                                _cleanup_free_ char *comm = NULL;
-                                (void) get_process_comm(i->main_pid, &comm);
-                                if (comm)
-                                        printf(" (%s)", comm);
+
+                                if (arg_transport == BUS_TRANSPORT_LOCAL) {
+                                        _cleanup_free_ char *comm = NULL;
+
+                                        (void) get_process_comm(i->main_pid, &comm);
+                                        if (comm)
+                                                printf(" (%s)", comm);
+                                }
+
                         } else if (i->exit_code > 0) {
                                 printf(" (code=%s, ", sigchld_code_to_string(i->exit_code));
 
@@ -4277,9 +4282,11 @@ static void print_status_info(
 
                         printf(PID_FMT, i->control_pid);
 
-                        (void) get_process_comm(i->control_pid, &c);
-                        if (c)
-                                printf(" (%s)", c);
+                        if (arg_transport == BUS_TRANSPORT_LOCAL) {
+                                (void) get_process_comm(i->control_pid, &c);
+                                if (c)
+                                        printf(" (%s)", c);
+                        }
                 }
 
                 printf("\n");