From: Paul B. Henson Date: Sun, 28 Jul 2019 18:55:26 +0000 (-0700) Subject: Fix -4 option when IPv6 disabled X-Git-Url: https://git.gsnw.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=509f5a59cb717edf3b4ef7fe0fbf6d31f0ed0199;p=fping.git Fix -4 option when IPv6 disabled When IPv6 is disabled, hints_ai_family is set to AF_INET at initialization, resulting in the error "can't specify both -4 and -6" if the -4 option is supplied. If there's no IPv6, make the -4 option a no-op. --- diff --git a/src/fping.c b/src/fping.c index 9650db9..bd76f32 100644 --- a/src/fping.c +++ b/src/fping.c @@ -427,11 +427,13 @@ int main(int argc, char** argv) while ((c = optparse_long(&optparse_state, longopts, NULL)) != EOF) { switch (c) { case '4': +#ifdef IPV6 if (hints_ai_family != AF_UNSPEC) { fprintf(stderr, "%s: can't specify both -4 and -6\n", prog); exit(1); } hints_ai_family = AF_INET; +#endif break; case '6': #ifdef IPV6