From: Lennart Poettering Date: Fri, 1 Dec 2017 10:21:58 +0000 (+0100) Subject: systemctl: don't use get_process_comm() on non-local PIDs (#7518) X-Git-Tag: v236~86 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=a081b9cea09ce4aec33be31b8ad9ad4f40906ccf;p=thirdparty%2Fsystemd.git systemctl: don't use get_process_comm() on non-local PIDs (#7518) 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 --- diff --git a/src/systemctl/systemctl.c b/src/systemctl/systemctl.c index e52b4e32be2..e121d580cff 100644 --- a/src/systemctl/systemctl.c +++ b/src/systemctl/systemctl.c @@ -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");