]> git.ipfire.org Git - thirdparty/iproute2.git/commitdiff
ifstat: fix warning about conditional
authorStephen Hemminger <stephen@networkplumber.org>
Wed, 28 Jun 2023 23:35:25 +0000 (16:35 -0700)
committerStephen Hemminger <stephen@networkplumber.org>
Wed, 28 Jun 2023 23:35:25 +0000 (16:35 -0700)
Gcc with warnings enabled complains because the conditional.
  if ((long)(a - b) < 0)
could be construed as never true.  Change to simple comparison.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
misc/ifstat.c

index 4ce5ca8af4e74e8d6b5b211b09fdd0b808f80759..f6f9ba5027d3a3e395d49bf06e4e8566caa065c3 100644 (file)
@@ -608,7 +608,7 @@ static void update_db(int interval)
                                int i;
 
                                for (i = 0; i < MAXS; i++) {
-                                       if ((long)(h1->ival[i] - n->ival[i]) < 0) {
+                                       if (h1->ival[i] < n->ival[i]) {
                                                memset(n->ival, 0, sizeof(n->ival));
                                                break;
                                        }