diff options
-rw-r--r-- | chmod_chown_chgrp.c | 4 | ||||
-rw-r--r-- | coreutils/id.c | 8 | ||||
-rw-r--r-- | id.c | 8 | ||||
-rw-r--r-- | internal.h | 10 | ||||
-rw-r--r-- | utility.c | 20 |
5 files changed, 25 insertions, 25 deletions
diff --git a/chmod_chown_chgrp.c b/chmod_chown_chgrp.c index d5c21a220..c782eb3c4 100644 --- a/chmod_chown_chgrp.c +++ b/chmod_chown_chgrp.c @@ -32,8 +32,8 @@ #include <pwd.h> -static uid_t uid = -1; -static gid_t gid = -1; +static unsigned long uid = -1; +static unsigned long gid = -1; static int whichApp; static char *invocationName = NULL; static char *theMode = NULL; diff --git a/coreutils/id.c b/coreutils/id.c index 16cf083e1..23bbc16ae 100644 --- a/coreutils/id.c +++ b/coreutils/id.c @@ -43,7 +43,7 @@ extern int id_main(int argc, char **argv) { int no_user = 0, no_group = 0, print_real = 0; char *cp, *user, *group; - gid_t gid; + unsigned long gid; cp = user = group = NULL; @@ -82,10 +82,10 @@ extern int id_main(int argc, char **argv) my_getgrgid(group, gid); } - if (no_group) printf("%u\n", my_getpwnam(user)); - else if (no_user) printf("%u\n", my_getgrnam(group)); + if (no_group) printf("%lu\n", my_getpwnam(user)); + else if (no_user) printf("%lu\n", my_getgrnam(group)); else - printf("uid=%u(%s) gid=%u(%s)\n", + printf("uid=%lu(%s) gid=%lu(%s)\n", my_getpwnam(user), user, my_getgrnam(group), group); @@ -43,7 +43,7 @@ extern int id_main(int argc, char **argv) { int no_user = 0, no_group = 0, print_real = 0; char *cp, *user, *group; - gid_t gid; + unsigned long gid; cp = user = group = NULL; @@ -82,10 +82,10 @@ extern int id_main(int argc, char **argv) my_getgrgid(group, gid); } - if (no_group) printf("%u\n", my_getpwnam(user)); - else if (no_user) printf("%u\n", my_getgrnam(group)); + if (no_group) printf("%lu\n", my_getpwnam(user)); + else if (no_user) printf("%lu\n", my_getgrnam(group)); else - printf("uid=%u(%s) gid=%u(%s)\n", + printf("uid=%lu(%s) gid=%lu(%s)\n", my_getpwnam(user), user, my_getgrnam(group), group); diff --git a/internal.h b/internal.h index 92b0255b0..eb498be43 100644 --- a/internal.h +++ b/internal.h @@ -257,11 +257,11 @@ extern char *cstring_lineFromFile(FILE *f); /* These parse entries in /etc/passwd and /etc/group. This is desirable * for BusyBox since we want to avoid using the glibc NSS stuff, which * increases target size and is often not needed embedded systems. */ -extern uid_t my_getpwnam(char *name); -extern gid_t my_getgrnam(char *name); -extern void my_getpwuid(char *name, uid_t uid); -extern void my_getgrgid(char *group, gid_t gid); -extern gid_t my_getpwnamegid(char *name); +extern unsigned long my_getpwnam(char *name); +extern unsigned long my_getgrnam(char *name); +extern void my_getpwuid(char *name, unsigned long uid); +extern void my_getgrgid(char *group, unsigned long gid); +extern unsigned long my_getpwnamegid(char *name); #if defined BB_INIT || defined BB_SYSLOGD @@ -797,12 +797,12 @@ extern int parse_mode(const char *s, mode_t * theMode) * This uses buf as storage to hold things. * */ -uid_t my_getid(const char *filename, char *name, uid_t id, gid_t *gid) +unsigned long my_getid(const char *filename, char *name, unsigned long id, unsigned long *gid) { FILE *file; char *rname, *start, *end, buf[128]; id_t rid; - gid_t rgid = 0; + unsigned long rgid = 0; file = fopen(filename, "r"); if (file == NULL) { @@ -830,13 +830,13 @@ uid_t my_getid(const char *filename, char *name, uid_t id, gid_t *gid) /* uid in passwd, gid in group */ start = end + 1; - rid = (uid_t) strtol(start, &end, 10); + rid = (unsigned long) strtol(start, &end, 10); if (end == start) continue; /* gid in passwd */ start = end + 1; - rgid = (gid_t) strtol(start, &end, 10); + rgid = (unsigned long) strtol(start, &end, 10); if (name) { if (0 == strcmp(rname, name)) { @@ -857,33 +857,33 @@ uid_t my_getid(const char *filename, char *name, uid_t id, gid_t *gid) } /* returns a uid given a username */ -uid_t my_getpwnam(char *name) +unsigned long my_getpwnam(char *name) { return my_getid("/etc/passwd", name, -1, NULL); } /* returns a gid given a group name */ -gid_t my_getgrnam(char *name) +unsigned long my_getgrnam(char *name) { return my_getid("/etc/group", name, -1, NULL); } /* gets a username given a uid */ -void my_getpwuid(char *name, uid_t uid) +void my_getpwuid(char *name, unsigned long uid) { my_getid("/etc/passwd", name, uid, NULL); } /* gets a groupname given a gid */ -void my_getgrgid(char *group, gid_t gid) +void my_getgrgid(char *group, unsigned long gid) { my_getid("/etc/group", group, gid, NULL); } /* gets a gid given a user name */ -gid_t my_getpwnamegid(char *name) +unsigned long my_getpwnamegid(char *name) { - gid_t gid; + unsigned long gid; my_getid("/etc/passwd", name, -1, &gid); return gid; } |