From 22c9d9f8916cef5eacc9c930fc25c34c24de17e4 Mon Sep 17 00:00:00 2001 From: Pat Riehecky Date: Fri, 1 Jun 2018 16:33:37 -0500 Subject: [PATCH] Fix static expressions in conditionals 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 Tested-by: BuildBot Reviewed-by: Andrew Deason Reviewed-by: Cheyenne Wills Reviewed-by: Benjamin Kaduk (cherry picked from commit 5cd5cd9fa8754a5af346fa6a392363b046316c75) Change-Id: Ie3a2d6bfc99d1b5adf0524afc29dac30b655d04d Reviewed-on: https://gerrit.openafs.org/13638 Tested-by: BuildBot Reviewed-by: Benjamin Kaduk Reviewed-by: Cheyenne Wills Reviewed-by: Michael Meffie Reviewed-by: Stephan Wiesand --- src/venus/cmdebug.c | 4 ++-- src/vlserver/vlclient.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/venus/cmdebug.c b/src/venus/cmdebug.c index a5596e7b4..bb1c95399 100644 --- a/src/venus/cmdebug.c +++ b/src/venus/cmdebug.c @@ -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; } diff --git a/src/vlserver/vlclient.c b/src/vlserver/vlclient.c index e22af50e0..8c5044c50 100644 --- a/src/vlserver/vlclient.c +++ b/src/vlserver/vlclient.c @@ -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; } -- 2.39.5