]> git.michaelhowe.org Git - packages/o/openafs.git/commitdiff
Fix static expressions in conditionals
authorPat Riehecky <riehecky@fnal.gov>
Fri, 1 Jun 2018 21:33:37 +0000 (16:33 -0500)
committerStephan Wiesand <stephan.wiesand@desy.de>
Thu, 25 Jul 2019 11:17:15 +0000 (07:17 -0400)
The conditions in these if statements are always true (or always false).
Remove the check in cmdebug.c, as it is unnecessary, and fix the check
in vlclient.c to actually check for a valid voltype. (via cppcheck)

Reviewed-on: https://gerrit.openafs.org/13158
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Cheyenne Wills <cwills@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
(cherry picked from commit 5cd5cd9fa8754a5af346fa6a392363b046316c75)

Change-Id: Ie3a2d6bfc99d1b5adf0524afc29dac30b655d04d
Reviewed-on: https://gerrit.openafs.org/13638
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Reviewed-by: Cheyenne Wills <cwills@sinenomine.net>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Stephan Wiesand <stephan.wiesand@desy.de>
src/venus/cmdebug.c
src/vlserver/vlclient.c

index a5596e7b406d6d5bc7a0436bf026860cd4f8e81d..bb1c95399193cae41c566494e652070dab235fb7 100644 (file)
@@ -569,8 +569,8 @@ CommandProc(struct cmd_syndesc *as, void *arock)
 
     if (int32p == 0 || int32p == 1)
         PrintLocks(conn, int32p);
-    if (int32p >= 0 || int32p <= 4)
-        PrintCacheEntries(conn, int32p);
+
+    PrintCacheEntries(conn, int32p);
     return 0;
 }
 
index e22af50e0d83cfbc9eca6f2b1506ef2fdbd4d510..8c5044c50234125e4d9f638dd75f5acb8436e60d 100644 (file)
@@ -687,7 +687,7 @@ handleit(struct cmd_syndesc *as, void *arock)
                sscanf(&(*argp)[0], "%d", &id);
                ++argp, --nargs;
                sscanf(&(*argp)[0], "%d", &voltype);
-               if (voltype < 0 && voltype > 2) {
+               if (voltype < 0 || voltype > 2) {
                    printf("Illegal voltype; must be 0, 1 or 2\n");
                    continue;
                }