diff --git a/arch/arm/bits/alltypes.h.sh b/arch/arm/bits/alltypes.h.sh index 748b8730..f1aca666 100755 --- a/arch/arm/bits/alltypes.h.sh +++ b/arch/arm/bits/alltypes.h.sh @@ -70,9 +70,9 @@ STRUCT timeval { time_t tv_sec; int tv_usec; }; STRUCT timespec { time_t tv_sec; long tv_nsec; }; TYPEDEF int pid_t; -TYPEDEF int id_t; -TYPEDEF int uid_t; -TYPEDEF int gid_t; +TYPEDEF unsigned id_t; +TYPEDEF unsigned uid_t; +TYPEDEF unsigned gid_t; TYPEDEF int key_t; TYPEDEF struct __pthread * pthread_t; diff --git a/arch/i386/bits/alltypes.h.sh b/arch/i386/bits/alltypes.h.sh index 85776a83..381e2c9b 100755 --- a/arch/i386/bits/alltypes.h.sh +++ b/arch/i386/bits/alltypes.h.sh @@ -84,9 +84,9 @@ STRUCT timeval { time_t tv_sec; int tv_usec; }; STRUCT timespec { time_t tv_sec; long tv_nsec; }; TYPEDEF int pid_t; -TYPEDEF int id_t; -TYPEDEF int uid_t; -TYPEDEF int gid_t; +TYPEDEF unsigned id_t; +TYPEDEF unsigned uid_t; +TYPEDEF unsigned gid_t; TYPEDEF int key_t; TYPEDEF struct __pthread * pthread_t; diff --git a/arch/microblaze/bits/alltypes.h.sh b/arch/microblaze/bits/alltypes.h.sh index a5acd494..032b45a4 100755 --- a/arch/microblaze/bits/alltypes.h.sh +++ b/arch/microblaze/bits/alltypes.h.sh @@ -70,9 +70,9 @@ STRUCT timeval { time_t tv_sec; int tv_usec; }; STRUCT timespec { time_t tv_sec; long tv_nsec; }; TYPEDEF int pid_t; -TYPEDEF int id_t; -TYPEDEF int uid_t; -TYPEDEF int gid_t; +TYPEDEF unsigned id_t; +TYPEDEF unsigned uid_t; +TYPEDEF unsigned gid_t; TYPEDEF int key_t; TYPEDEF struct __pthread * pthread_t; diff --git a/arch/mips/bits/alltypes.h.sh b/arch/mips/bits/alltypes.h.sh index a5acd494..032b45a4 100755 --- a/arch/mips/bits/alltypes.h.sh +++ b/arch/mips/bits/alltypes.h.sh @@ -70,9 +70,9 @@ STRUCT timeval { time_t tv_sec; int tv_usec; }; STRUCT timespec { time_t tv_sec; long tv_nsec; }; TYPEDEF int pid_t; -TYPEDEF int id_t; -TYPEDEF int uid_t; -TYPEDEF int gid_t; +TYPEDEF unsigned id_t; +TYPEDEF unsigned uid_t; +TYPEDEF unsigned gid_t; TYPEDEF int key_t; TYPEDEF struct __pthread * pthread_t; diff --git a/arch/powerpc/bits/alltypes.h.sh b/arch/powerpc/bits/alltypes.h.sh index 77d335bb..0cb90007 100755 --- a/arch/powerpc/bits/alltypes.h.sh +++ b/arch/powerpc/bits/alltypes.h.sh @@ -70,9 +70,9 @@ STRUCT timeval { time_t tv_sec; int tv_usec; }; STRUCT timespec { time_t tv_sec; long tv_nsec; }; TYPEDEF int pid_t; -TYPEDEF int id_t; -TYPEDEF int uid_t; -TYPEDEF int gid_t; +TYPEDEF unsigned id_t; +TYPEDEF unsigned uid_t; +TYPEDEF unsigned gid_t; TYPEDEF int key_t; TYPEDEF struct __pthread * pthread_t; diff --git a/arch/x86_64/bits/alltypes.h.sh b/arch/x86_64/bits/alltypes.h.sh index e5b8d47f..8f122c32 100755 --- a/arch/x86_64/bits/alltypes.h.sh +++ b/arch/x86_64/bits/alltypes.h.sh @@ -70,9 +70,9 @@ STRUCT timeval { time_t tv_sec; long tv_usec; }; STRUCT timespec { time_t tv_sec; long tv_nsec; }; TYPEDEF int pid_t; -TYPEDEF int id_t; -TYPEDEF unsigned int uid_t; -TYPEDEF unsigned int gid_t; +TYPEDEF unsigned id_t; +TYPEDEF unsigned uid_t; +TYPEDEF unsigned gid_t; TYPEDEF int key_t; TYPEDEF struct __pthread * pthread_t; diff --git a/src/passwd/getgrent_a.c b/src/passwd/getgrent_a.c index 780560dd..2cb85215 100644 --- a/src/passwd/getgrent_a.c +++ b/src/passwd/getgrent_a.c @@ -1,6 +1,13 @@ #include "pwf.h" #include +static unsigned atou(char **s) +{ + unsigned x; + for (x=0; **s-'0'<10U; ++*s) x=10*x+(**s-'0'); + return x; +} + struct group *__getgrent_a(FILE *f, struct group *gr, char **line, size_t *size, char ***mem, size_t *nmem) { ssize_t l; @@ -24,8 +31,8 @@ struct group *__getgrent_a(FILE *f, struct group *gr, char **line, size_t *size, *s++ = 0; gr->gr_passwd = s; if (!(s = strchr(s, ':'))) continue; - *s++ = 0; gr->gr_gid = atoi(s); - if (!(s = strchr(s, ':'))) continue; + *s++ = 0; gr->gr_gid = atou(&s); + if (*s != ':') continue; *s++ = 0; mems = s; break; diff --git a/src/passwd/getpwent_a.c b/src/passwd/getpwent_a.c index 1bd7f4fc..34842a07 100644 --- a/src/passwd/getpwent_a.c +++ b/src/passwd/getpwent_a.c @@ -1,6 +1,13 @@ #include "pwf.h" #include +static unsigned atou(char **s) +{ + unsigned x; + for (x=0; **s-'0'<10U; ++*s) x=10*x+(**s-'0'); + return x; +} + struct passwd *__getpwent_a(FILE *f, struct passwd *pw, char **line, size_t *size) { ssize_t l; @@ -23,11 +30,11 @@ struct passwd *__getpwent_a(FILE *f, struct passwd *pw, char **line, size_t *siz *s++ = 0; pw->pw_passwd = s; if (!(s = strchr(s, ':'))) continue; - *s++ = 0; pw->pw_uid = atoi(s); - if (!(s = strchr(s, ':'))) continue; + *s++ = 0; pw->pw_uid = atou(&s); + if (*s != ':') continue; - *s++ = 0; pw->pw_gid = atoi(s); - if (!(s = strchr(s, ':'))) continue; + *s++ = 0; pw->pw_gid = atou(&s); + if (*s != ':') continue; *s++ = 0; pw->pw_gecos = s; if (!(s = strchr(s, ':'))) continue;