diff options
-rw-r--r-- | src/basic/process-util.c | 8 | ||||
-rw-r--r-- | src/login/logind-dbus.c | 4 |
2 files changed, 6 insertions, 6 deletions
diff --git a/src/basic/process-util.c b/src/basic/process-util.c index 22d6f5059..62c7acfa2 100644 --- a/src/basic/process-util.c +++ b/src/basic/process-util.c @@ -478,7 +478,7 @@ static int get_process_id(pid_t pid, const char *field, uid_t *uid) { assert(field); assert(uid); - if (!pid_is_valid(pid)) + if (pid < 0) return -EINVAL; p = procfs_file_alloca(pid, "status"); @@ -793,7 +793,7 @@ int getenv_for_pid(pid_t pid, const char *field, char **_value) { bool pid_is_unwaited(pid_t pid) { /* Checks whether a PID is still valid at all, including a zombie */ - if (!pid_is_valid(pid)) + if (pid < 0) return false; if (pid <= 1) /* If we or PID 1 would be dead and have been waited for, this code would not be running */ @@ -813,7 +813,7 @@ bool pid_is_alive(pid_t pid) { /* Checks whether a PID is still valid and not a zombie */ - if (!pid_is_valid(pid)) + if (pid < 0) return false; if (pid <= 1) /* If we or PID 1 would be a zombie, this code would not be running */ @@ -833,7 +833,7 @@ bool pid_is_alive(pid_t pid) { int pid_from_same_root_fs(pid_t pid) { const char *root; - if (!pid_is_valid(pid)) + if (pid < 0) return false; if (pid == 0 || pid == getpid_cached()) diff --git a/src/login/logind-dbus.c b/src/login/logind-dbus.c index 63cd1a4d4..4d75e3e15 100644 --- a/src/login/logind-dbus.c +++ b/src/login/logind-dbus.c @@ -348,7 +348,7 @@ static int method_get_session_by_pid(sd_bus_message *message, void *userdata, sd r = sd_bus_message_read(message, "u", &pid); if (r < 0) return r; - if (!pid_is_valid((pid_t) pid)) + if (pid < 0) return -EINVAL; if (pid == 0) { @@ -411,7 +411,7 @@ static int method_get_user_by_pid(sd_bus_message *message, void *userdata, sd_bu r = sd_bus_message_read(message, "u", &pid); if (r < 0) return r; - if (!pid_is_valid((pid_t) pid)) + if (pid < 0) return -EINVAL; if (pid == 0) { |