mirror of
https://github.com/systemd/systemd.git
synced 2024-11-01 09:21:26 +03:00
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
This commit is contained in:
parent
6ae3fccb7d
commit
a081b9cea0
@ -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");
|
||||
|
Loading…
Reference in New Issue
Block a user