Skip to content

Commit

Permalink
ping: options -4 and -6 are mutually exclusive
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
kerolasa committed Jul 22, 2019
1 parent 2306892 commit 50385e3
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions ping.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand Down

0 comments on commit 50385e3

Please sign in to comment.