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:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user