diff options
Diffstat (limited to 'networking/ping6.c')
-rw-r--r-- | networking/ping6.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/networking/ping6.c b/networking/ping6.c index b95e098ad..c691fa74b 100644 --- a/networking/ping6.c +++ b/networking/ping6.c | |||
@@ -42,6 +42,8 @@ enum { | |||
42 | PINGINTERVAL = 1 /* second */ | 42 | PINGINTERVAL = 1 /* second */ |
43 | }; | 43 | }; |
44 | 44 | ||
45 | static const char *hostname; | ||
46 | |||
45 | static void ping(const char *host); | 47 | static void ping(const char *host); |
46 | 48 | ||
47 | #ifndef CONFIG_FEATURE_FANCY_PING6 | 49 | #ifndef CONFIG_FEATURE_FANCY_PING6 |
@@ -50,7 +52,7 @@ static void ping(const char *host); | |||
50 | 52 | ||
51 | static void noresp(int ign) | 53 | static void noresp(int ign) |
52 | { | 54 | { |
53 | printf("No response from %s\n", h->h_name); | 55 | printf("No response from %s\n", hostname); |
54 | exit(EXIT_FAILURE); | 56 | exit(EXIT_FAILURE); |
55 | } | 57 | } |
56 | 58 | ||
@@ -63,6 +65,8 @@ static void ping(const char *host) | |||
63 | int sockopt; | 65 | int sockopt; |
64 | char packet[DEFDATALEN + MAXIPLEN + MAXICMPLEN]; | 66 | char packet[DEFDATALEN + MAXIPLEN + MAXICMPLEN]; |
65 | 67 | ||
68 | hostname = host; | ||
69 | |||
66 | pingsock = create_icmp6_socket(); | 70 | pingsock = create_icmp6_socket(); |
67 | 71 | ||
68 | lsa = host_and_af2sockaddr(host, 0, AF_INET6); | 72 | lsa = host_and_af2sockaddr(host, 0, AF_INET6); |
@@ -105,7 +109,7 @@ static void ping(const char *host) | |||
105 | } | 109 | } |
106 | if (ENABLE_FEATURE_CLEAN_UP) | 110 | if (ENABLE_FEATURE_CLEAN_UP) |
107 | close(pingsock); | 111 | close(pingsock); |
108 | printf("%s is alive!\n", h->h_name); | 112 | printf("%s is alive!\n", hostname); |
109 | } | 113 | } |
110 | 114 | ||
111 | int ping6_main(int argc, char **argv) | 115 | int ping6_main(int argc, char **argv) |