hostname: make -i not emit extra trailing space
authorDenys Vlasenko <vda.linux@googlemail.com>
Sun, 1 Apr 2012 14:52:21 +0000 (16:52 +0200)
committerDenys Vlasenko <vda.linux@googlemail.com>
Sun, 1 Apr 2012 14:52:21 +0000 (16:52 +0200)
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
networking/hostname.c

index 5f663908cf5524a686a09d3ecd97da0d33123d1a..d2516b5fb904c6f46e77d534dee78dd4369bdb77 100644 (file)
@@ -153,7 +153,7 @@ int hostname_main(int argc UNUSED_PARAM, char **argv)
                        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));
+                                       printf(h_addr_list[1] ? "%s " : "%s", inet_ntoa(**h_addr_list));
                                        h_addr_list++;
                                }
                                bb_putchar('\n');