Whamcloud - gitweb
fsck: fix strange logic
authorAndreas Dilger <andreas.dilger@intel.com>
Wed, 10 Aug 2016 22:21:19 +0000 (18:21 -0400)
committerTheodore Ts'o <tytso@mit.edu>
Wed, 10 Aug 2016 22:21:19 +0000 (18:21 -0400)
commit713edbd08252a02e70638222ced86c838c320a57
tree83fb3bca6424f71cd3063afe2962a92219e977d3
parent127e2291bf02c39bba58eb9b8096a2670319a5bb
fsck: fix strange logic

llvm warns about the confusingly written comparison:

                              !strncmp(argv[i+1], "-", 1) == 0) {
    misc/fsck.c:1178 col 9: warning: logical not is only applied to
      the left hand side of comparison [-Wlogical-not-parentheses]
    misc/fsck.c:1178 col 9: note: add parentheses after the '!' to
      evaluate the comparison first
    misc/fsck.c:1178 col 9: note: add parentheses around left hand
      side expression to silence this warning

It makes sense to simplify this to a character comparison rather
than using strncmp() to check only one character.

Signed-off-by: Andreas Dilger <andreas.dilger@intel.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
misc/fsck.c