diff options
author | Matt Kraai <kraai@debian.org> | 2001-05-16 15:40:51 +0000 |
---|---|---|
committer | Matt Kraai <kraai@debian.org> | 2001-05-16 15:40:51 +0000 |
commit | c55b8d41c15640fa1637f919b3f6eca6e781047a (patch) | |
tree | 03c1fca61c1b577b7c527d2b8482c5b7f6972bcd /networking/ping.c | |
parent | 59df6f73988b103f0dcfffeaec10642527336c5e (diff) |
Add xgethostbyname and herror_msg* functions.
Diffstat (limited to 'networking/ping.c')
-rw-r--r-- | networking/ping.c | 19 |
1 files changed, 5 insertions, 14 deletions
diff --git a/networking/ping.c b/networking/ping.c index 8b82dcaac..0967999a9 100644 --- a/networking/ping.c +++ b/networking/ping.c @@ -1,6 +1,6 @@ /* vi: set sw=4 ts=4: */ /* - * $Id: ping.c,v 1.40 2001/04/09 23:52:18 andersen Exp $ + * $Id: ping.c,v 1.41 2001/05/16 15:40:48 kraai Exp $ * Mini ping implementation for busybox * * Copyright (C) 1999 by Randolph Chung <tausq@debian.org> @@ -200,10 +200,7 @@ static void ping(const char *host) memset(&pingaddr, 0, sizeof(struct sockaddr_in)); pingaddr.sin_family = AF_INET; - if (!(h = gethostbyname(host))) { - error_msg("unknown host %s", host); - exit(1); - } + h = xgethostbyname(host); memcpy(&pingaddr.sin_addr, h->h_addr, sizeof(pingaddr.sin_addr)); hostname = h->h_name; @@ -446,15 +443,9 @@ static void ping(const char *host) memset(&pingaddr, 0, sizeof(struct sockaddr_in)); pingaddr.sin_family = AF_INET; - if (!(h = gethostbyname(host))) { - error_msg("unknown host %s", host); - exit(1); - } - - if (h->h_addrtype != AF_INET) { - error_msg("unknown address type; only AF_INET is currently supported."); - exit(1); - } + h = gethostbyname(host); + if (h->h_addrtype != AF_INET) + error_msg_and_die("unknown address type; only AF_INET is currently supported."); pingaddr.sin_family = AF_INET; /* h->h_addrtype */ memcpy(&pingaddr.sin_addr, h->h_addr, sizeof(pingaddr.sin_addr)); |