On Tue, Jun 13, 2017 at 08:02:13PM +0200, Klemens Nanni wrote:
> Unify option checking and simply logic.
>
> F_HDRINCL and F_ROUTE are mutually exclusive, thus check the latter only
> if the former one is not set.
>
> Index: ping.c
> ===================================================================
> RCS file: /cvs/src/sbin/ping/ping.c,v
> retrieving revision 1.218
> diff -u -p -r1.218 ping.c
> --- ping.c 22 Feb 2017 13:43:35 -0000 1.218
> +++ ping.c 13 Jun 2017 17:38:22 -0000
> @@ -562,17 +562,17 @@ main(int argc, char *argv[])
> (void)setsockopt(s, SOL_SOCKET, SO_DEBUG, &optval,
> sizeof(optval));
>
> - if ((options & F_FLOOD) && (options & F_INTERVAL))
> + if (options & (F_FLOOD | F_INTERVAL))
> errx(1, "-f and -i options are incompatible");
>
> - if ((options & F_FLOOD) && (options & (F_AUD_RECV | F_AUD_MISS)))
> + if (options & (F_FLOOD | F_AUD_RECV | F_AUD_MISS))
> warnx("No audible output for flood pings");
Did you try to compile and run this?
if (options & (F_FLOOD | F_INTERVAL))
is equivalent to
if ((options & F_FLOOD) || (options & F_INTERVAL))
^^
so this changes behaviour and is most likely wrong.
natano