]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
chfn: use direct equality check for semantic clarity and readability
authorChristian Goeschel Ndjomouo <cgoesc2@wgu.edu>
Wed, 14 Jan 2026 05:41:14 +0000 (00:41 -0500)
committerKarel Zak <kzak@redhat.com>
Thu, 29 Jan 2026 11:16:57 +0000 (12:16 +0100)
Signed-off-by: Christian Goeschel Ndjomouo <cgoesc2@wgu.edu>
login-utils/chfn.c

index b7cae61761aa8cf5bf881300671ebf72072fcab3..c5435a8bc44d471dd77901084a88d3207b471b8b 100644 (file)
@@ -248,7 +248,7 @@ static char *ask_new_field(struct chfn_control *ctl, const char *question,
                        free(buf);
                        return xstrdup(def_val);
                }
-               if (!c_strcasecmp(buf, "none")) {
+               if (c_strcasecmp(buf, "none") == 0) {
                        free(buf);
                        ctl->changed = 1;
                        return xstrdup("");
@@ -276,11 +276,11 @@ static void get_login_defs(struct chfn_control *ctl)
                return;
        }
        s = getlogindefs_str("CHFN_RESTRICT", "");
-       if (!strcmp(s, "yes")) {
+       if (strcmp(s, "yes") == 0) {
                ctl->allow_room = ctl->allow_work = ctl->allow_home = 1;
                return;
        }
-       if (!strcmp(s, "no")) {
+       if (strcmp(s, "no") == 0) {
                ctl->allow_fullname = ctl->allow_room = ctl->allow_work = ctl->allow_home = 1;
                return;
        }