parse-util: introduce pid_is_valid()

Checking for validity of a PID is relatively easy, but let's add a
helper cal for this too, in order to make things more readable and more
similar to uid_is_valid(), gid_is_valid() and friends.
This commit is contained in:
Lennart Poettering
2017-07-31 18:01:42 +02:00
parent cad93f2996
commit 54191eb3e7
3 changed files with 7 additions and 2 deletions
+1 -1
View File
@@ -59,7 +59,7 @@ int parse_pid(const char *s, pid_t* ret_pid) {
if ((unsigned long) pid != ul)
return -ERANGE;
if (pid <= 0)
if (!pid_is_valid(pid))
return -ERANGE;
*ret_pid = pid;