diff options
author | Lennart Poettering <lennart@poettering.net> | 2017-08-31 10:25:06 +0200 |
---|---|---|
committer | Sven Eden <yamakuzure@gmx.net> | 2017-08-31 10:25:06 +0200 |
commit | 9fc8db12dbccc9e71f2c0761030eb5dbb9c1ff7a (patch) | |
tree | babd6ef484e781d1f3b053a5cd46048074195d11 /src/basic | |
parent | bc8491844602f0d0626af7ff9e0f988a546bf1d7 (diff) |
tree-wide: use pid_is_valid() at more places
Diffstat (limited to 'src/basic')
-rw-r--r-- | src/basic/process-util.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/basic/process-util.c b/src/basic/process-util.c index 4dcb93f2d..98f5a38ae 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 < 0) + if (!pid_is_valid(pid)) return -EINVAL; p = procfs_file_alloca(pid, "status"); @@ -794,7 +794,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 < 0) + if (!pid_is_valid(pid)) return false; if (pid <= 1) /* If we or PID 1 would be dead and have been waited for, this code would not be running */ @@ -814,7 +814,7 @@ bool pid_is_alive(pid_t pid) { /* Checks whether a PID is still valid and not a zombie */ - if (pid < 0) + if (!pid_is_valid(pid)) return false; if (pid <= 1) /* If we or PID 1 would be a zombie, this code would not be running */ @@ -834,7 +834,7 @@ bool pid_is_alive(pid_t pid) { int pid_from_same_root_fs(pid_t pid) { const char *root; - if (pid < 0) + if (!pid_is_valid(pid)) return false; if (pid == 0 || pid == getpid_cached()) |