mirror of
https://github.com/systemd/systemd-stable.git
synced 2025-02-09 09:57:26 +03:00
main: check if we have a valid PID before getting the name of it
This commit is contained in:
parent
f9b72cd804
commit
dfa7f7e139
@ -354,7 +354,9 @@ static int write_message(Server *s, const char *buf, struct ucred *ucred) {
|
|||||||
/* Then, add process if set */
|
/* Then, add process if set */
|
||||||
if (read_process(&buf, &iovec[i]) > 0)
|
if (read_process(&buf, &iovec[i]) > 0)
|
||||||
i++;
|
i++;
|
||||||
else if (ucred && get_process_name(ucred->pid, &process) >= 0)
|
else if (ucred &&
|
||||||
|
ucred->pid > 0 &&
|
||||||
|
get_process_name(ucred->pid, &process) >= 0)
|
||||||
IOVEC_SET_STRING(iovec[i++], process);
|
IOVEC_SET_STRING(iovec[i++], process);
|
||||||
|
|
||||||
/* Skip the stored PID if we have a better one */
|
/* Skip the stored PID if we have a better one */
|
||||||
|
@ -2070,7 +2070,9 @@ static int manager_process_signal_fd(Manager *m) {
|
|||||||
return -errno;
|
return -errno;
|
||||||
}
|
}
|
||||||
|
|
||||||
get_process_name(sfsi.ssi_pid, &p);
|
if (sfsi.ssi_pid > 0)
|
||||||
|
get_process_name(sfsi.ssi_pid, &p);
|
||||||
|
|
||||||
log_debug("Received SIG%s from PID %lu (%s)",
|
log_debug("Received SIG%s from PID %lu (%s)",
|
||||||
strna(signal_to_string(sfsi.ssi_signo)),
|
strna(signal_to_string(sfsi.ssi_signo)),
|
||||||
(unsigned long) sfsi.ssi_pid, strna(p));
|
(unsigned long) sfsi.ssi_pid, strna(p));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user