From 6f1713f216fef686a68db5ee02232bc67e525c7d Mon Sep 17 00:00:00 2001 From: Denis Vlasenko <vda.linux@googlemail.com> Date: Mon, 25 Feb 2008 23:23:58 +0000 Subject: *: 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 --- libbb/lineedit.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) (limited to 'libbb/lineedit.c') diff --git a/libbb/lineedit.c b/libbb/lineedit.c index 9aab63702..c6aa45c93 100644 --- a/libbb/lineedit.c +++ b/libbb/lineedit.c @@ -1203,11 +1203,7 @@ static void parse_and_put_prompt(const char *prmt_ptr) break; #endif case 'h': - pbuf = free_me = xzalloc(256); - if (gethostname(pbuf, 255) < 0) { - pbuf[0] = '?'; - pbuf[1] = '\0'; - } + pbuf = free_me = safe_gethostname(); *strchrnul(pbuf, '.') = '\0'; break; case '$': -- cgit v1.2.3-55-g6feb