diff options
author | Denis Vlasenko <vda.linux@googlemail.com> | 2008-02-25 23:23:58 +0000 |
---|---|---|
committer | Denis Vlasenko <vda.linux@googlemail.com> | 2008-02-25 23:23:58 +0000 |
commit | 6f1713f216fef686a68db5ee02232bc67e525c7d (patch) | |
tree | 256adc75a88723a4b247c32e692d721d65243a82 /miscutils | |
parent | 394eebed6656dfc2e56a79500b602023000ac415 (diff) | |
download | busybox-w32-6f1713f216fef686a68db5ee02232bc67e525c7d.tar.gz busybox-w32-6f1713f216fef686a68db5ee02232bc67e525c7d.tar.bz2 busybox-w32-6f1713f216fef686a68db5ee02232bc67e525c7d.zip |
*: intrduce and use safe_gethostname. By Tito <farmatito AT tiscali.it>
safe_gethostname - 48 +48
glob3 35 37 +2
timestamp_and_log 314 315 +1
udhcp_send_kernel_packet 234 231 -3
scan_tree 275 271 -4
passwd_main 1074 1070 -4
print_login_prompt 68 58 -10
obscure 392 377 -15
syslogd_main 882 866 -16
print_login_issue 516 478 -38
hostname_main 278 223 -55
parse_and_put_prompt 825 756 -69
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 2/9 up/down: 51/-214) Total: -163 bytes
text data bss dec hex filename
798791 728 7484 807003 c505b busybox_old
798631 728 7484 806843 c4fbb busybox_unstripped
Diffstat (limited to 'miscutils')
-rw-r--r-- | miscutils/devfsd.c | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/miscutils/devfsd.c b/miscutils/devfsd.c index 52a65bc98..286f00fd8 100644 --- a/miscutils/devfsd.c +++ b/miscutils/devfsd.c | |||
@@ -1133,8 +1133,8 @@ static void signal_handler(int sig) | |||
1133 | static const char *get_variable(const char *variable, void *info) | 1133 | static const char *get_variable(const char *variable, void *info) |
1134 | { | 1134 | { |
1135 | static char sbuf[sizeof(int)*3 + 2]; /* sign and NUL */ | 1135 | static char sbuf[sizeof(int)*3 + 2]; /* sign and NUL */ |
1136 | static char *hostname; | ||
1136 | 1137 | ||
1137 | char hostname[STRING_LENGTH]; | ||
1138 | struct get_variable_info *gv_info = info; | 1138 | struct get_variable_info *gv_info = info; |
1139 | const char *field_names[] = { | 1139 | const char *field_names[] = { |
1140 | "hostname", "mntpt", "devpath", "devname", | 1140 | "hostname", "mntpt", "devpath", "devname", |
@@ -1143,12 +1143,8 @@ static const char *get_variable(const char *variable, void *info) | |||
1143 | }; | 1143 | }; |
1144 | int i; | 1144 | int i; |
1145 | 1145 | ||
1146 | if (gethostname(hostname, STRING_LENGTH - 1) != 0) | 1146 | if (!hostname) |
1147 | /* Here on error we should do exit(RV_SYS_ERROR), instead we do exit(EXIT_FAILURE) */ | 1147 | hostname = safe_gethostname(); |
1148 | error_logger_and_die(LOG_ERR, "gethostname"); | ||
1149 | |||
1150 | hostname[STRING_LENGTH - 1] = '\0'; | ||
1151 | |||
1152 | /* index_in_str_array returns i>=0 */ | 1148 | /* index_in_str_array returns i>=0 */ |
1153 | i = index_in_str_array(field_names, variable); | 1149 | i = index_in_str_array(field_names, variable); |
1154 | 1150 | ||