From 7adff6b2cad30de073fb597cd0d10826067965ad Mon Sep 17 00:00:00 2001 From: Elliott Hughes Date: Thu, 10 Oct 2019 14:12:28 -0700 Subject: hostname: fix error reporting. The functions have their own errno :-( --- toys/lsb/hostname.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/toys/lsb/hostname.c b/toys/lsb/hostname.c index b3cc1967..daa60cc0 100644 --- a/toys/lsb/hostname.c +++ b/toys/lsb/hostname.c @@ -61,7 +61,8 @@ void hostname_main(void) // We only do the DNS lookup for -d and -f. if (FLAG(d) || FLAG(f)) { - if (!(h = gethostbyname(toybuf))) perror_exit("gethostbyname"); + if (!(h = gethostbyname(toybuf))) + error_exit("gethostbyname: %s", hstrerror(h_errno)); snprintf(toybuf, sizeof(toybuf), "%s", h->h_name); } dot = toybuf+strcspn(toybuf, "."); -- cgit v1.2.3