diff options
author | Matt Kraai | 2001-05-16 15:40:51 +0000 |
---|---|---|
committer | Matt Kraai | 2001-05-16 15:40:51 +0000 |
commit | c55b8d41c15640fa1637f919b3f6eca6e781047a (patch) | |
tree | 03c1fca61c1b577b7c527d2b8482c5b7f6972bcd /ping.c | |
parent | 59df6f73988b103f0dcfffeaec10642527336c5e (diff) | |
download | busybox-c55b8d41c15640fa1637f919b3f6eca6e781047a.zip busybox-c55b8d41c15640fa1637f919b3f6eca6e781047a.tar.gz |
Add xgethostbyname and herror_msg* functions.
Diffstat (limited to 'ping.c')
-rw-r--r-- | ping.c | 19 |
1 files changed, 5 insertions, 14 deletions
@@ -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)); |