summaryrefslogtreecommitdiffstats
path: root/src/util
diff options
context:
space:
mode:
authorJakub Hrozek <jhrozek@redhat.com>2010-10-25 15:14:24 +0200
committerStephen Gallagher <sgallagh@redhat.com>2010-10-26 08:00:21 -0400
commit580374daba2ab2c6075a7d0de9512abff133e2e9 (patch)
treedfd9abe14efa5f6c79291ef72b1d2ac0b8326334 /src/util
parent13147b598a8409c338abb9472e74bbd606f224bd (diff)
downloadsssd-580374daba2ab2c6075a7d0de9512abff133e2e9.tar.gz
sssd-580374daba2ab2c6075a7d0de9512abff133e2e9.tar.xz
sssd-580374daba2ab2c6075a7d0de9512abff133e2e9.zip
Always use uint32_t for UID/GID numbers
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 0937c6648..e4d4ca8be 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 744e0f71a..bf1b21a62 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);