From 509f5a59cb717edf3b4ef7fe0fbf6d31f0ed0199 Mon Sep 17 00:00:00 2001 From: "Paul B. Henson" Date: Sun, 28 Jul 2019 11:55:26 -0700 Subject: [PATCH] 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. --- src/fping.c | 2 ++ 1 file changed, 2 insertions(+) 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