From 6460b0e4e0a264acdc2e6822a6789492540166a5 Mon Sep 17 00:00:00 2001 From: florian Date: Sat, 8 Jul 2017 16:22:29 +0000 Subject: [PATCH] Consistently use if ((option & F_FOO) && (option & F_BAR)) instead of if (option & F_FOO && option & F_BAR). Prompted by a reverse diff from Klemens Nanni. Both forms are equivalent due to operator precedence, I consider the later to be easier on the eyes. --- sbin/ping/ping.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/sbin/ping/ping.c b/sbin/ping/ping.c index a837a77237f..5f21e7919c3 100644 --- a/sbin/ping/ping.c +++ b/sbin/ping/ping.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ping.c,v 1.222 2017/07/08 16:21:51 florian Exp $ */ +/* $OpenBSD: ping.c,v 1.223 2017/07/08 16:22:29 florian Exp $ */ /* * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. @@ -573,7 +573,7 @@ main(int argc, char *argv[]) if (v6flag) { /* in F_VERBOSE case, we may get non-echoreply packets*/ - if (options & F_VERBOSE && datalen < 2048) /* XXX 2048? */ + if ((options & F_VERBOSE) && datalen < 2048) /* XXX 2048? */ packlen = 2048 + IP6LEN + ECHOLEN + EXTRA; else packlen = datalen + IP6LEN + ECHOLEN + EXTRA; @@ -696,7 +696,7 @@ main(int argc, char *argv[]) options |= F_HDRINCL; } - if (options & F_RROUTE && options & F_HDRINCL) + if ((options & F_RROUTE) && (options & F_HDRINCL)) errx(1, "-R option and -D or -T, or -t to unicast" " destinations are incompatible"); @@ -1092,7 +1092,7 @@ pinger(int s) warn("sendmsg"); printf("ping: wrote %s %d chars, ret=%d\n", hostname, cc, i); } - if (!(options & F_QUIET) && options & F_FLOOD) + if (!(options & F_QUIET) && (options & F_FLOOD)) write(STDOUT_FILENO, &DOT, 1); return (0); -- 2.20.1