summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSami Kerola <kerolasa@iki.fi>2019-07-22 18:43:14 +0100
committerSami Kerola <kerolasa@iki.fi>2019-07-22 18:47:47 +0100
commit50385e36b6f7ec3468d8deb0589ca928abc2c8c1 (patch)
treefe40524e4834a211a9cbe34f7648ab8884f44443
parent230689297b25a600b410e3ee810d6de6452a50aa (diff)
downloadiputils-50385e36b6f7ec3468d8deb0589ca928abc2c8c1.tar.gz
ping: options -4 and -6 are mutually exclusive
Mutual exclusiveness should not stop use of -4 or -6 multiple times. Such usage is probably unintentional, but we can allow that without problems. Signed-off-by: Sami Kerola <kerolasa@iki.fi>
-rw-r--r--ping.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/ping.c b/ping.c
index 4a1dcc0..95b782e 100644
--- a/ping.c
+++ b/ping.c
@@ -299,7 +299,7 @@ main(int argc, char **argv)
switch(ch) {
/* IPv4 specific options */
case '4':
- if (hints.ai_family != AF_UNSPEC)
+ if (hints.ai_family == AF_INET6)
error(2, 0, _("only one -4 or -6 option may be specified"));
hints.ai_family = AF_INET;
break;
@@ -326,7 +326,7 @@ main(int argc, char **argv)
break;
/* IPv6 specific options */
case '6':
- if (hints.ai_family != AF_UNSPEC)
+ if (hints.ai_family == AF_INET)
error(2, 0, _("only one -4 or -6 option may be specified"));
hints.ai_family = AF_INET6;
break;