summaryrefslogtreecommitdiff
path: root/src/util
diff options
context:
space:
mode:
Diffstat (limited to 'src/util')
-rw-r--r--src/util/find_uid.c6
-rw-r--r--src/util/strtonum.c2
2 files changed, 4 insertions, 4 deletions
diff --git a/src/util/find_uid.c b/src/util/find_uid.c
index 0937c664..e4d4ca8b 100644
--- a/src/util/find_uid.c
+++ b/src/util/find_uid.c
@@ -38,6 +38,7 @@
#include "dhash.h"
#include "util/util.h"
+#include "util/strtonum.h"
#define INITIAL_TABLE_SIZE 64
#define PATHLEN (NAME_MAX + 14)
@@ -63,7 +64,7 @@ static errno_t get_uid_from_pid(const pid_t pid, uid_t *uid)
char *p;
char *e;
char *endptr;
- unsigned long num=0;
+ uint32_t num=0;
errno_t error;
ret = snprintf(path, PATHLEN, "/proc/%d/status", pid);
@@ -131,8 +132,7 @@ static errno_t get_uid_from_pid(const pid_t pid, uid_t *uid)
} else {
*e = '\0';
}
- errno = 0;
- num = strtoul(p, &endptr, 10);
+ num = strtouint32(p, &endptr, 10);
error = errno;
if (error != 0) {
DEBUG(1, ("strtol failed [%s].\n", strerror(error)));
diff --git a/src/util/strtonum.c b/src/util/strtonum.c
index 744e0f71..bf1b21a6 100644
--- a/src/util/strtonum.c
+++ b/src/util/strtonum.c
@@ -51,7 +51,7 @@ int32_t strtoint32(const char *nptr, char **endptr, int base)
/* strtouint32 */
uint32_t strtouint32(const char *nptr, char **endptr, int base)
{
- long long ret = 0;
+ unsigned long long ret = 0;
errno = 0;
ret = strtoull(nptr, endptr, base);