diff options
| author | Denis Vlasenko <vda.linux@googlemail.com> | 2008-09-14 19:31:36 +0000 |
|---|---|---|
| committer | Denis Vlasenko <vda.linux@googlemail.com> | 2008-09-14 19:31:36 +0000 |
| commit | 0d602e9386cc651ca0ba534b309fce0582fa8e99 (patch) | |
| tree | 7b159d92dbf169f762ae991fc0fc3e771eda101b /coreutils | |
| parent | 2bc5c033dc9c7a6b32535eb0e13a676684e1c17d (diff) | |
| download | busybox-w32-0d602e9386cc651ca0ba534b309fce0582fa8e99.tar.gz busybox-w32-0d602e9386cc651ca0ba534b309fce0582fa8e99.tar.bz2 busybox-w32-0d602e9386cc651ca0ba534b309fce0582fa8e99.zip | |
id: unsigned long is excessive for option bitmask
Diffstat (limited to 'coreutils')
| -rw-r--r-- | coreutils/id.c | 22 |
1 files changed, 8 insertions, 14 deletions
diff --git a/coreutils/id.c b/coreutils/id.c index cf642c209..5225f357c 100644 --- a/coreutils/id.c +++ b/coreutils/id.c | |||
| @@ -25,7 +25,7 @@ | |||
| 25 | #define JUST_CONTEXT 32 | 25 | #define JUST_CONTEXT 32 |
| 26 | #endif | 26 | #endif |
| 27 | 27 | ||
| 28 | static int printf_full(unsigned int id, const char *arg, const char *prefix) | 28 | static int printf_full(unsigned id, const char *arg, const char *prefix) |
| 29 | { | 29 | { |
| 30 | const char *fmt = "%s%u"; | 30 | const char *fmt = "%s%u"; |
| 31 | int status = EXIT_FAILURE; | 31 | int status = EXIT_FAILURE; |
| @@ -46,7 +46,7 @@ int id_main(int argc UNUSED_PARAM, char **argv) | |||
| 46 | gid_t gid; | 46 | gid_t gid; |
| 47 | gid_t *groups; | 47 | gid_t *groups; |
| 48 | int n; | 48 | int n; |
| 49 | unsigned long flags; | 49 | unsigned flags; |
| 50 | short status; | 50 | short status; |
| 51 | #if ENABLE_SELINUX | 51 | #if ENABLE_SELINUX |
| 52 | security_context_t scontext; | 52 | security_context_t scontext; |
| @@ -81,7 +81,7 @@ int id_main(int argc UNUSED_PARAM, char **argv) | |||
| 81 | if (flags & NAME_NOT_NUMBER) | 81 | if (flags & NAME_NOT_NUMBER) |
| 82 | printf("%s", bb_getgrgid(NULL, 0, *groups++)); | 82 | printf("%s", bb_getgrgid(NULL, 0, *groups++)); |
| 83 | else | 83 | else |
| 84 | printf("%d", (int) *groups++); | 84 | printf("%u", (unsigned) *groups++); |
| 85 | bb_putchar((n > 0) ? ' ' : '\n'); | 85 | bb_putchar((n > 0) ? ' ' : '\n'); |
| 86 | } | 86 | } |
| 87 | /* exit */ | 87 | /* exit */ |
| @@ -91,14 +91,14 @@ int id_main(int argc UNUSED_PARAM, char **argv) | |||
| 91 | if (flags & (JUST_GROUP | JUST_USER USE_SELINUX(| JUST_CONTEXT))) { | 91 | if (flags & (JUST_GROUP | JUST_USER USE_SELINUX(| JUST_CONTEXT))) { |
| 92 | /* JUST_GROUP and JUST_USER are mutually exclusive */ | 92 | /* JUST_GROUP and JUST_USER are mutually exclusive */ |
| 93 | if (flags & NAME_NOT_NUMBER) { | 93 | if (flags & NAME_NOT_NUMBER) { |
| 94 | /* bb_getXXXid(-1) exit on failure, puts cannot segfault */ | 94 | /* bb_getXXXid(-1) exits on failure, puts cannot segfault */ |
| 95 | puts((flags & JUST_USER) ? bb_getpwuid(NULL, -1, uid) : bb_getgrgid(NULL, -1, gid)); | 95 | puts((flags & JUST_USER) ? bb_getpwuid(NULL, -1, uid) : bb_getgrgid(NULL, -1, gid)); |
| 96 | } else { | 96 | } else { |
| 97 | if (flags & JUST_USER) { | 97 | if (flags & JUST_USER) { |
| 98 | printf("%u\n", uid); | 98 | printf("%u\n", (unsigned)uid); |
| 99 | } | 99 | } |
| 100 | if (flags & JUST_GROUP) { | 100 | if (flags & JUST_GROUP) { |
| 101 | printf("%u\n", gid); | 101 | printf("%u\n", (unsigned)gid); |
| 102 | } | 102 | } |
| 103 | } | 103 | } |
| 104 | 104 | ||
| @@ -136,16 +136,10 @@ int id_main(int argc UNUSED_PARAM, char **argv) | |||
| 136 | #if ENABLE_SELINUX | 136 | #if ENABLE_SELINUX |
| 137 | if (is_selinux_enabled()) { | 137 | if (is_selinux_enabled()) { |
| 138 | security_context_t mysid; | 138 | security_context_t mysid; |
| 139 | const char *context; | ||
| 140 | |||
| 141 | context = "unknown"; | ||
| 142 | getcon(&mysid); | 139 | getcon(&mysid); |
| 143 | if (mysid) { | 140 | printf(" context=%s", mysid ? mysid : "unknown"); |
| 144 | context = alloca(strlen(mysid) + 1); | 141 | if (mysid) /* TODO: maybe freecon(NULL) is harmless? */ |
| 145 | strcpy((char*)context, mysid); | ||
| 146 | freecon(mysid); | 142 | freecon(mysid); |
| 147 | } | ||
| 148 | printf(" context=%s", context); | ||
| 149 | } | 143 | } |
| 150 | #endif | 144 | #endif |
| 151 | 145 | ||
