diff options
| author | Denys Vlasenko <vda.linux@googlemail.com> | 2009-09-09 23:12:10 +0200 |
|---|---|---|
| committer | Denys Vlasenko <vda.linux@googlemail.com> | 2009-09-09 23:12:10 +0200 |
| commit | d069e5398d7538bdcf0e97c357c28aade3d01a28 (patch) | |
| tree | f4ed8b62dbed942bbac2bddb19463f48da3af9de | |
| parent | e66ccfaa2c0a575f56202dd343de923929cf1f38 (diff) | |
| download | busybox-w32-d069e5398d7538bdcf0e97c357c28aade3d01a28.tar.gz busybox-w32-d069e5398d7538bdcf0e97c357c28aade3d01a28.tar.bz2 busybox-w32-d069e5398d7538bdcf0e97c357c28aade3d01a28.zip | |
a few more GCC-isms removed
text data bss dec hex filename
824641 458 6956 832055 cb237 busybox_old
824631 458 6956 832045 cb22d busybox_unstripped
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| -rw-r--r-- | coreutils/logname.c | 2 | ||||
| -rw-r--r-- | editors/awk.c | 2 | ||||
| -rw-r--r-- | loginutils/su.c | 23 |
3 files changed, 20 insertions, 7 deletions
diff --git a/coreutils/logname.c b/coreutils/logname.c index 3400c30d9..7983d1704 100644 --- a/coreutils/logname.c +++ b/coreutils/logname.c | |||
| @@ -27,7 +27,7 @@ | |||
| 27 | int logname_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; | 27 | int logname_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; |
| 28 | int logname_main(int argc, char **argv UNUSED_PARAM) | 28 | int logname_main(int argc, char **argv UNUSED_PARAM) |
| 29 | { | 29 | { |
| 30 | char buf[128]; | 30 | char buf[64]; |
| 31 | 31 | ||
| 32 | if (argc > 1) { | 32 | if (argc > 1) { |
| 33 | bb_show_usage(); | 33 | bb_show_usage(); |
diff --git a/editors/awk.c b/editors/awk.c index 30f09cbaf..cb98a67b6 100644 --- a/editors/awk.c +++ b/editors/awk.c | |||
| @@ -114,7 +114,7 @@ typedef struct nvblock_s { | |||
| 114 | var *pos; | 114 | var *pos; |
| 115 | struct nvblock_s *prev; | 115 | struct nvblock_s *prev; |
| 116 | struct nvblock_s *next; | 116 | struct nvblock_s *next; |
| 117 | var nv[0]; | 117 | var nv[]; |
| 118 | } nvblock; | 118 | } nvblock; |
| 119 | 119 | ||
| 120 | typedef struct tsplitter_s { | 120 | typedef struct tsplitter_s { |
diff --git a/loginutils/su.c b/loginutils/su.c index a8b852b09..a3f7ed8a0 100644 --- a/loginutils/su.c +++ b/loginutils/su.c | |||
| @@ -40,11 +40,24 @@ int su_main(int argc UNUSED_PARAM, char **argv) | |||
| 40 | 40 | ||
| 41 | if (ENABLE_FEATURE_SU_SYSLOG) { | 41 | if (ENABLE_FEATURE_SU_SYSLOG) { |
| 42 | /* The utmp entry (via getlogin) is probably the best way to identify | 42 | /* The utmp entry (via getlogin) is probably the best way to identify |
| 43 | the user, especially if someone su's from a su-shell. | 43 | * the user, especially if someone su's from a su-shell. |
| 44 | But getlogin can fail -- usually due to lack of utmp entry. | 44 | * But getlogin can fail -- usually due to lack of utmp entry. |
| 45 | in this case resort to getpwuid. */ | 45 | * in this case resort to getpwuid. */ |
| 46 | old_user = xstrdup(IF_FEATURE_UTMP(getlogin() ? : ) (pw = getpwuid(cur_uid)) ? pw->pw_name : ""); | 46 | const char *user; |
| 47 | tty = xmalloc_ttyname(2) ? : "none"; | 47 | #if ENABLE_FEATURE_UTMP |
| 48 | char user_buf[64]; | ||
| 49 | user = user_buf; | ||
| 50 | if (getlogin_r(user_buf, sizeof(user_buf)) != 0) | ||
| 51 | #endif | ||
| 52 | { | ||
| 53 | pw = getpwuid(cur_uid); | ||
| 54 | user = pw ? pw->pw_name : ""; | ||
| 55 | } | ||
| 56 | old_user = xstrdup(user); | ||
| 57 | tty = xmalloc_ttyname(2); | ||
| 58 | if (!tty) { | ||
| 59 | tty = "none"; | ||
| 60 | } | ||
| 48 | openlog(applet_name, 0, LOG_AUTH); | 61 | openlog(applet_name, 0, LOG_AUTH); |
| 49 | } | 62 | } |
| 50 | 63 | ||
