summaryrefslogtreecommitdiffstats
path: root/src/util
diff options
context:
space:
mode:
Diffstat (limited to 'src/util')
-rw-r--r--src/util/find_uid.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/util/find_uid.c b/src/util/find_uid.c
index 02d668636..0937c6648 100644
--- a/src/util/find_uid.c
+++ b/src/util/find_uid.c
@@ -63,7 +63,7 @@ static errno_t get_uid_from_pid(const pid_t pid, uid_t *uid)
char *p;
char *e;
char *endptr;
- long num=0;
+ unsigned long num=0;
errno_t error;
ret = snprintf(path, PATHLEN, "/proc/%d/status", pid);
@@ -132,9 +132,9 @@ static errno_t get_uid_from_pid(const pid_t pid, uid_t *uid)
*e = '\0';
}
errno = 0;
- num = strtol(p, &endptr, 10);
+ num = strtoul(p, &endptr, 10);
error = errno;
- if (error == ERANGE) {
+ if (error != 0) {
DEBUG(1, ("strtol failed [%s].\n", strerror(error)));
return error;
}
@@ -143,7 +143,7 @@ static errno_t get_uid_from_pid(const pid_t pid, uid_t *uid)
return EINVAL;
}
- if (num < 0 || num >= INT_MAX) {
+ if (num >= UINT32_MAX) {
DEBUG(1, ("uid out of range.\n"));
return ERANGE;
}