[git commit] hostname: make -i not emit extra trailing space

Denys Vlasenko vda.linux at googlemail.com
Sun Apr 1 14:52:21 UTC 2012


commit: http://git.busybox.net/busybox/commit/?id=1d9e99b399e72763045a2428e04b32278538ccc7
branch: http://git.busybox.net/busybox/commit/?id=refs/heads/master

Signed-off-by: Denys Vlasenko <vda.linux at googlemail.com>
---
 networking/hostname.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/networking/hostname.c b/networking/hostname.c
index 5f66390..d2516b5 100644
--- a/networking/hostname.c
+++ b/networking/hostname.c
@@ -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');


More information about the busybox-cvs mailing list