From 99069330a104e6d360635174be5f5ed054c418b8 Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Sat, 27 Feb 2010 19:38:19 +0100 Subject: *: gethostname-related fixes function old new delta hostname_main 218 231 +13 nfsmount 3541 3474 -67 Signed-off-by: Denys Vlasenko --- networking/hostname.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'networking') diff --git a/networking/hostname.c b/networking/hostname.c index 579eff7..121ad40 100644 --- a/networking/hostname.c +++ b/networking/hostname.c @@ -132,10 +132,14 @@ int hostname_main(int argc UNUSED_PARAM, char **argv) if (*p) puts(p + 1); } else /*if (opts & OPT_i)*/ { - while (hp->h_addr_list[0]) { - printf("%s ", inet_ntoa(*(struct in_addr *) (*hp->h_addr_list++))); + if (hp->h_length == sizeof(struct in_addr)) { + struct in_addr **h_addr_list = (struct in_addr **)hp->h_addr_list; + while (*h_addr_list) { + printf("%s ", inet_ntoa(**h_addr_list)); + h_addr_list++; + } + bb_putchar('\n'); } - bb_putchar('\n'); } } else if (opts & OPT_F) { /* Set the hostname */ -- cgit v1.1