diff --git a/lib/get_pid.c b/lib/get_pid.c index af3f2f8e..4e8f4ef2 100644 --- a/lib/get_pid.c +++ b/lib/get_pid.c @@ -14,27 +14,14 @@ #include #include +#include "atoi/a2i.h" #include "string/sprintf.h" int get_pid(const char *pidstr, pid_t *pid) { - char *end; - long long val; - - errno = 0; - val = strtoll(pidstr, &end, 10); - if ( ('\0' == *pidstr) - || ('\0' != *end) - || (0 != errno) - || (val < 1) - || (/*@+longintegral@*/val != (pid_t)val)/*@=longintegral@*/) { - return -1; - } - - *pid = val; - return 0; + return a2i(pid_t, pid, pidstr, NULL, 10, 1, type_max(pid_t)); } /*