]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
[clang-tidy] fix wrong *cmp usage
authorRosen Penev <rosenp@gmail.com>
Sun, 19 Apr 2020 05:32:29 +0000 (22:32 -0700)
committerRosen Penev <rosenp@gmail.com>
Mon, 20 Apr 2020 20:21:00 +0000 (13:21 -0700)
Found with bugprone-suspicious-string-compare

Signed-off-by: Rosen Penev <rosenp@gmail.com>
33 files changed:
disk-utils/fsck.c
disk-utils/fsck.minix.c
disk-utils/partx.c
lib/ismounted.c
lib/loopdev.c
lib/swapprober.c
lib/sysfs.c
libblkid/src/devname.c
libblkid/src/partitions/atari.c
libblkid/src/superblocks/ntfs.c
libblkid/src/superblocks/vfat.c
libblkid/src/tag.c
libfdisk/src/sgi.c
libmount/src/context.c
libmount/src/context_umount.c
libmount/src/optmap.c
libmount/src/optstr.c
libmount/src/tab_diff.c
libmount/src/tab_parse.c
login-utils/login.c
login-utils/su-common.c
misc-utils/findmnt.c
misc-utils/hardlink.c
misc-utils/lsblk-properties.c
sys-utils/chmem.c
sys-utils/lscpu-arm.c
sys-utils/lscpu.c
sys-utils/lsmem.c
sys-utils/setarch.c
term-utils/agetty.c
term-utils/write.c
tests/helpers/test_strerror.c
text-utils/hexdump-display.c

index 8391e5d940592df9a6c871ff8b0d81dae8dfbe97..fda80a6fe85be0c6fe3e8ec9f7ddb1cf8d5ca754 100644 (file)
@@ -819,10 +819,10 @@ static struct fsck_instance *wait_one(int flags)
                for (inst2 = instance_list; inst2; inst2 = inst2->next) {
                        if (inst2->flags & FLAG_DONE)
                                continue;
-                       if (strcmp(inst2->type, "ext2") &&
+                       if (strcmp(inst2->type, "ext2") != 0 &&
                            strcmp(inst2->type, "ext3") &&
-                           strcmp(inst2->type, "ext4") &&
-                           strcmp(inst2->type, "ext4dev"))
+                           strcmp(inst2->type, "ext4") != 0 &&
+                           strcmp(inst2->type, "ext4dev") != 0)
                                continue;
                        /*
                         * If we've just started the fsck, wait a tiny
@@ -903,8 +903,8 @@ static int fsck_device(struct libmnt_fs *fs, int interactive)
 
        if (type && strcmp(type, "auto") != 0)
                ;
-       else if (fstype && strncmp(fstype, "no", 2) &&
-           strncmp(fstype, "opts=", 5) && strncmp(fstype, "loop", 4) &&
+       else if (fstype && strncmp(fstype, "no", 2) != 0 &&
+           strncmp(fstype, "opts=", 5) != 0 && strncmp(fstype, "loop", 4) != 0 &&
            !strchr(fstype, ','))
                type = fstype;
        else
index d3725ee0d1822463cf891af5872adb9b79a0d398..bd44f5bd12e8fe5f0cfb39ff0e6b5c3ba6c76fae 100644 (file)
@@ -976,7 +976,7 @@ check_file(struct minix_inode *dir, unsigned int offset) {
        inode = get_inode(ino);
        name_depth--;
        if (!offset) {
-               if (!inode || strcmp(".", name)) {
+               if (!inode || strcmp(".", name) != 0) {
                        get_current_name();
                        printf(_("%s: bad directory: '.' isn't first\n"),
                               current_name);
@@ -985,7 +985,7 @@ check_file(struct minix_inode *dir, unsigned int offset) {
                        return;
        }
        if (offset == dirsize) {
-               if (!inode || strcmp("..", name)) {
+               if (!inode || strcmp("..", name) != 0) {
                        get_current_name();
                        printf(_("%s: bad directory: '..' isn't second\n"),
                               current_name);
@@ -1049,7 +1049,7 @@ check_file2(struct minix2_inode *dir, unsigned int offset) {
        inode = get_inode2(ino);
        name_depth--;
        if (!offset) {
-               if (!inode || strcmp(".", name)) {
+               if (!inode || strcmp(".", name) != 0) {
                        get_current_name();
                        printf(_("%s: bad directory: '.' isn't first\n"),
                               current_name);
@@ -1058,7 +1058,7 @@ check_file2(struct minix2_inode *dir, unsigned int offset) {
                        return;
        }
        if (offset == dirsize) {
-               if (!inode || strcmp("..", name)) {
+               if (!inode || strcmp("..", name) != 0) {
                        get_current_name();
                        printf(_("%s: bad directory: '..' isn't second\n"),
                               current_name);
index 4f73c5f23805a62f732c173a87a08bb07a8e091b..07b3e28b9e88b7d840fee7670c255762fd8d51e7 100644 (file)
@@ -245,7 +245,7 @@ static int get_max_partno(const char *disk, dev_t devno)
                if (d->d_type != DT_DIR && d->d_type != DT_UNKNOWN)
                        continue;
 #endif
-               if (strncmp(parent, d->d_name, strlen(parent)))
+               if (strncmp(parent, d->d_name, strlen(parent)) != 0)
                        continue;
                snprintf(path, sizeof(path), "%s/partition", d->d_name);
 
index fe4c329a7c34017b572619eea660e66f50524a68..9a20b236739b5c2a8eb63569433ef95800c10ccc 100644 (file)
@@ -272,7 +272,7 @@ static int is_swap_device(const char *file)
        /* Skip the first line */
        if (!fgets(buf, sizeof(buf), f))
                goto leave;
-       if (*buf && strncmp(buf, "Filename\t", 9))
+       if (*buf && strncmp(buf, "Filename\t", 9) != 0)
                /* Linux <=2.6.19 contained a bug in the /proc/swaps
                 * code where the header would not be displayed
                 */
index 76eac7b8dcac8fedcdf8e996f75e8481887d91eb..70cc0c23a668d4aeeaf350adb83c657a0bf46e12 100644 (file)
@@ -1806,7 +1806,7 @@ int loopdev_count_by_backing_file(const char *filename, char **loopdev)
        while(loopcxt_next(&lc) == 0) {
                char *backing = loopcxt_get_backing_file(&lc);
 
-               if (!backing || strcmp(backing, filename)) {
+               if (!backing || strcmp(backing, filename) != 0) {
                        free(backing);
                        continue;
                }
index 5a4b112e15cbb4ac628e570519632bd368a866bb..aaf9ad0fa2ac863cdf18b96c0ba01201481e75b7 100644 (file)
@@ -37,7 +37,7 @@ blkid_probe get_swap_prober(const char *devname)
                /* Only the SWAPSPACE2 is supported. */
                if (blkid_probe_lookup_value(pr, "VERSION", &version, NULL) == 0
                    && version
-                   && strcmp(version, stringify_value(SWAP_VERSION)))
+                   && strcmp(version, stringify_value(SWAP_VERSION)) != 0)
                        warnx(_("%s: unsupported swap version '%s'"),
                                                devname, version);
                else
index ce944001f9f4e9ae4979e73efef73635fd11bb2e..227a1e9f2c646a3f96116bfe9eb2318ddefcf57c 100644 (file)
@@ -869,7 +869,7 @@ dev_t __sysfs_devname_to_devno(const char *prefix, const char *name, const char
                goto done;
        sysfs_devname_dev_to_sys(_name);
 
-       if (parent && strncmp("dm-", name, 3)) {
+       if (parent && strncmp("dm-", name, 3) != 0) {
                /*
                 * Create path to /sys/block/<parent>/<name>/dev
                 */
index 3a0f8aba61ec98e94e949475eaf1d68215df4001..c58b784cc5ded09406cbad0c09608c66cef0ed5c 100644 (file)
@@ -58,7 +58,7 @@ blkid_dev blkid_get_dev(blkid_cache cache, const char *devname, int flags)
        /* search by name */
        list_for_each(p, &cache->bic_devs) {
                tmp = list_entry(p, struct blkid_struct_dev, bid_devs);
-               if (strcmp(tmp->bid_name, devname))
+               if (strcmp(tmp->bid_name, devname) != 0)
                        continue;
                dev = tmp;
                break;
@@ -70,7 +70,7 @@ blkid_dev blkid_get_dev(blkid_cache cache, const char *devname, int flags)
                        DBG(DEVNAME, ul_debug("search canonical %s", cn));
                        list_for_each(p, &cache->bic_devs) {
                                tmp = list_entry(p, struct blkid_struct_dev, bid_devs);
-                               if (strcmp(tmp->bid_name, cn))
+                               if (strcmp(tmp->bid_name, cn) != 0)
                                        continue;
                                dev = tmp;
 
@@ -120,13 +120,13 @@ blkid_dev blkid_get_dev(blkid_cache cache, const char *devname, int flags)
                        if (dev2->bid_flags & BLKID_BID_FL_VERIFIED)
                                continue;
                        if (!dev->bid_type || !dev2->bid_type ||
-                           strcmp(dev->bid_type, dev2->bid_type))
+                           strcmp(dev->bid_type, dev2->bid_type) != 0)
                                continue;
                        if (dev->bid_label && dev2->bid_label &&
-                           strcmp(dev->bid_label, dev2->bid_label))
+                           strcmp(dev->bid_label, dev2->bid_label) != 0)
                                continue;
                        if (dev->bid_uuid && dev2->bid_uuid &&
-                           strcmp(dev->bid_uuid, dev2->bid_uuid))
+                           strcmp(dev->bid_uuid, dev2->bid_uuid) != 0)
                                continue;
                        if ((dev->bid_label && !dev2->bid_label) ||
                            (!dev->bid_label && dev2->bid_label) ||
@@ -160,7 +160,7 @@ static int is_dm_leaf(const char *devname)
        while ((de = readdir(dir)) != NULL) {
                if (!strcmp(de->d_name, ".") || !strcmp(de->d_name, "..") ||
                    !strcmp(de->d_name, devname) ||
-                   strncmp(de->d_name, "dm-", 3) ||
+                   strncmp(de->d_name, "dm-", 3) != 0 ||
                    strlen(de->d_name) > sizeof(path)-32)
                        continue;
                sprintf(path, "/sys/block/%s/slaves", de->d_name);
@@ -544,7 +544,7 @@ static int probe_all(blkid_cache cache, int only_if_new)
                 * dev, and the device's base name has changed,
                 * check last as well.
                 */
-               if (lens[last] && strncmp(ptnames[last], ptname, lens[last])) {
+               if (lens[last] && strncmp(ptnames[last], ptname, lens[last]) != 0) {
                        DBG(DEVNAME, ul_debug(" whole dev %s, devno 0x%04X",
                                   ptnames[last], (unsigned int) devs[last]));
                        probe_one(cache, ptnames[last], devs[last], 0,
index 48c3226702510d6acce2570e5334b299618b47a1..f8b6fb5b536c2f64cee3f14c7120757a47dbd7d8 100644 (file)
@@ -164,7 +164,7 @@ static int parse_extended(blkid_probe pr, blkid_partlist ls,
                if (!IS_ACTIVE(xrs->part[i+1]))
                        break;
 
-               if (memcmp(xrs->part[i+1].id, "XGM", 3))
+               if (memcmp(xrs->part[i+1].id, "XGM", 3) != 0)
                        return 0;
 
                xstart = x0start + be32_to_cpu(xrs->part[i+1].start);
index 02487e21981b16dad50834741b53fed951fd9b9b..be2e3d895f9873b95228d8caee8d5842e4ede2bd 100644 (file)
@@ -162,7 +162,7 @@ static int __probe_ntfs(blkid_probe pr, const struct blkid_idmag *mag, int save_
        if (!buf_mft)
                return errno ? -errno : 1;
 
-       if (memcmp(buf_mft, "FILE", 4))
+       if (memcmp(buf_mft, "FILE", 4) != 0)
                return 1;
 
        off += MFT_RECORD_VOLUME * mft_record_size;
@@ -171,7 +171,7 @@ static int __probe_ntfs(blkid_probe pr, const struct blkid_idmag *mag, int save_
        if (!buf_mft)
                return errno ? -errno : 1;
 
-       if (memcmp(buf_mft, "FILE", 4))
+       if (memcmp(buf_mft, "FILE", 4) != 0)
                return 1;
 
        /* return if caller does not care about UUID and LABEL */
index 7c01ceb02222bcc6f4f9e328163c4b363f71a081..c7a3d080c8fd3fca50cd6acb2eed10a63deb5658 100644 (file)
@@ -425,7 +425,7 @@ static int probe_vfat(blkid_probe pr, const struct blkid_idmag *mag)
                }
        }
 
-       if (boot_label && memcmp(boot_label, no_name, 11))
+       if (boot_label && memcmp(boot_label, no_name, 11) != 0)
                blkid_probe_set_id_label(pr, "LABEL_FATBOOT", boot_label, 11);
 
        if (vol_label)
index f6b67f66e22eec5d019a4054405048b59dcd89f6..390a648648133bca4407c0086e413c734acf71d2 100644 (file)
@@ -73,7 +73,7 @@ int blkid_dev_has_tag(blkid_dev dev, const char *type,
        tag = blkid_find_tag_dev(dev, type);
        if (!value)
                return (tag != NULL);
-       if (!tag || strcmp(tag->bit_val, value))
+       if (!tag || strcmp(tag->bit_val, value) != 0)
                return 0;
        return 1;
 }
index d5391b51a6e303a18f9c177e6feea43dd1898faa..6b4b5d116fe93beb0d39cf0db099a410d868de18 100644 (file)
@@ -413,7 +413,7 @@ static int sgi_check_bootfile(struct fdisk_context *cxt, const char *name)
        }
 
        if (strncmp(name, (char *) sgilabel->boot_file,
-                               sizeof(sgilabel->boot_file))) {
+                               sizeof(sgilabel->boot_file)) != 0) {
                fdisk_warnx(cxt, _("Be aware that the bootfile is not checked "
                                   "for existence.  SGI's default is \"/unix\", "
                                   "and for backup \"/unix.save\"."));
index 2b598dbb9dd3d78d82bdf4e97aa399181b52b917..8b548b20ff6bc3339304c47d6ce5f8d955357897 100644 (file)
@@ -1808,7 +1808,7 @@ int mnt_context_prepare_srcpath(struct libmnt_context *cxt)
                 * Source is PATH (canonicalize)
                 */
                path = mnt_resolve_path(src, cache);
-               if (path && strcmp(path, src))
+               if (path && strcmp(path, src) != 0)
                        rc = mnt_fs_set_source(cxt->fs, path);
         }
 
index f3e079981e17df3c57de7f82841efadc389facb2..e1cf7c688530ead30df3b9609d5660eb00a09237 100644 (file)
@@ -388,7 +388,7 @@ static int is_associated_fs(const char *devname, struct libmnt_fs *fs)
        int flags = 0;
 
        /* check if it begins with /dev/loop */
-       if (strncmp(devname, _PATH_DEV_LOOP, sizeof(_PATH_DEV_LOOP) - 1))
+       if (strncmp(devname, _PATH_DEV_LOOP, sizeof(_PATH_DEV_LOOP) - 1) != 0)
                return 0;
 
        src = mnt_fs_get_srcpath(fs);
index 1f3ace3d8ed8d26fcb5db1eb8e16d663eac3ec40..a080d8df6fc70b5172e284213e55e32ddd5cf609 100644 (file)
@@ -249,7 +249,7 @@ const struct libmnt_optmap *mnt_optmap_get_entry(
                                }
                                continue;
                        }
-                       if (strncmp(ent->name, name, namelen))
+                       if (strncmp(ent->name, name, namelen) != 0)
                                continue;
                        p = ent->name + namelen;
                        if (*p == '\0' || *p == '=' || *p == '[') {
index f975cef24b51d98f975fd65ecd1705fae440d5a7..781bb29806de5e3c369fdd1b70b9886d5760e285 100644 (file)
@@ -1077,7 +1077,7 @@ int mnt_optstr_fix_user(char **optstr)
        if (!username)
                return -ENOMEM;
 
-       if (!ol.valsz || (ol.value && strncmp(ol.value, username, ol.valsz))) {
+       if (!ol.valsz || (ol.value && strncmp(ol.value, username, ol.valsz) != 0)) {
                if (ol.valsz)
                        /* remove old value */
                        mnt_optstr_remove_option_at(optstr, ol.value, ol.end);
index fdb1ef5c2c3a135706c94cb7654feff658e0832c..81694bc6df495ecb6747fcf4bc7b2a4bfdd1eda0 100644 (file)
@@ -277,7 +277,7 @@ int mnt_diff_tables(struct libmnt_tabdiff *df, struct libmnt_table *old_tab,
                                   *f1 = mnt_fs_get_fs_options(o_fs),
                                   *f2 = mnt_fs_get_fs_options(fs);
 
-                       if ((v1 && v2 && strcmp(v1, v2)) || (f1 && f2 && strcmp(f1, f2)))
+                       if ((v1 && v2 && strcmp(v1, v2) != 0) || (f1 && f2 && strcmp(f1, f2) != 0))
                                tabdiff_add_entry(df, o_fs, fs, MNT_TABDIFF_REMOUNT);
                }
        }
index ffcf245790be23e312ea70bb60915be70462060e..3b52f6b287ff967b126b85e0838b797fb27c5b23 100644 (file)
@@ -885,7 +885,7 @@ static int mnt_table_parse_dir_filter(const struct dirent *d)
        namesz = strlen(d->d_name);
        if (!namesz || namesz < MNT_MNTTABDIR_EXTSIZ + 1 ||
            strcmp(d->d_name + (namesz - MNT_MNTTABDIR_EXTSIZ),
-                  MNT_MNTTABDIR_EXT))
+                  MNT_MNTTABDIR_EXT) != 0)
                return 0;
 
        /* Accept this */
index 457bd980a3ec4f54cdf92c1900d15b3ff86f29c5..30940a6f8f679245260cd683f3b58c534f3ae53d 100644 (file)
@@ -377,7 +377,7 @@ static void init_tty(struct login_context *cxt)
         */
        if (!cxt->tty_path || !*cxt->tty_path ||
            lstat(cxt->tty_path, &st) != 0 || !S_ISCHR(st.st_mode) ||
-           (st.st_nlink > 1 && strncmp(cxt->tty_path, "/dev/", 5)) ||
+           (st.st_nlink > 1 && strncmp(cxt->tty_path, "/dev/", 5) != 0) ||
            access(cxt->tty_path, R_OK | W_OK) != 0) {
 
                syslog(LOG_ERR, _("FATAL: bad tty"));
index e671d822b070a66fb31f73064a28e357de85652c..3cd7f595e810ac179b9e088e2d1a3d4e71d94b9a 100644 (file)
@@ -1149,7 +1149,7 @@ int su_main(int argc, char **argv, int mode)
                        shell = getenv("SHELL");
 
                if (shell
-                   && strcmp(shell, su->pwd->pw_shell)
+                   && strcmp(shell, su->pwd->pw_shell) != 0
                    && getuid() != 0
                    && is_restricted_shell(su->pwd->pw_shell)) {
                        /* The user being su'd to has a nonstandard shell, and
index 53f647fc1a8bb672e2f1093f79815f38092ca2ba..43b4dc7d638203da42e469e06cd2f9b79e898a26 100644 (file)
@@ -524,7 +524,7 @@ static char *get_data(struct libmnt_fs *fs, int num)
                        if (spec && (flags & FL_EVALUATE))
                                spec = cn = mnt_resolve_spec(spec, cache);
                }
-               if (root && spec && !(flags & FL_NOFSROOT) && strcmp(root, "/"))
+               if (root && spec && !(flags & FL_NOFSROOT) && strcmp(root, "/") != 0)
                        xasprintf(&str, "%s[%s]", spec, root);
                else if (spec)
                        str = xstrdup(spec);
index 63615896b024cb5d4bbe047036aa9c2d85e78a24..e985aafe25c19b364331b4766b06e6dc8ed43af5 100644 (file)
@@ -296,7 +296,7 @@ static void process_path(struct hardlink_ctl *ctl, const char *name)
                                                close(fd2);
                                                return;
                                        }
-                                       if (memcmp(ctl->iobuf1, ctl->iobuf2, rsize))
+                                       if (memcmp(ctl->iobuf1, ctl->iobuf2, rsize) != 0)
                                                break;
                                }
                                close(fd2);
index a1c73bc7d0cd9d5cddbef47b0520597c9a068167..6f41eacfd044e8a7ca21af450fdb35108c0e8a66 100644 (file)
@@ -136,7 +136,7 @@ static int lookup(char *buf, char *pattern, char **value)
                return 0;
 
        len = strlen(pattern);
-       if (strncmp(buf, pattern, len))
+       if (strncmp(buf, pattern, len) != 0)
                return 0;
 
        p = buf + len;
index b3645be19d5113a5a7aea39813a6fab5dedab291..2f231d6645f7049749529775e644759042a0c0b8 100644 (file)
@@ -133,7 +133,7 @@ static int chmem_size(struct chmem_desc *desc, int enable, int zone_id)
                                zn = zone_names[zone_id];
                                if (enable && !strcasestr(line, zn))
                                        continue;
-                               if (!enable && strncasecmp(line, zn, strlen(zn)))
+                               if (!enable && strncasecmp(line, zn, strlen(zn)) != 0)
                                        continue;
                        } else if (enable) {
                                /* By default, use zone Movable for online, if valid */
@@ -218,7 +218,7 @@ static int chmem_range(struct chmem_desc *desc, int enable, int zone_id)
                                        warnx(_("%s enable failed: Zone mismatch"), str);
                                        continue;
                                }
-                               if (!enable && strncasecmp(line, zn, strlen(zn))) {
+                               if (!enable && strncasecmp(line, zn, strlen(zn)) != 0) {
                                        warnx(_("%s disable failed: Zone mismatch"), str);
                                        continue;
                                }
@@ -251,7 +251,7 @@ static int chmem_range(struct chmem_desc *desc, int enable, int zone_id)
 
 static int filter(const struct dirent *de)
 {
-       if (strncmp("memory", de->d_name, 6))
+       if (strncmp("memory", de->d_name, 6) != 0)
                return 0;
        return isdigit_string(de->d_name + 6);
 }
index ef9d1ff90e92d8fe8723ae1c47b72cebf78db03c..aa7d826d469deb4ac0ee058a92bedefa4177d9b7 100644 (file)
@@ -209,7 +209,7 @@ void arm_cpu_decode(struct lscpu_desc *desc)
 
        if (desc->vendor == NULL || desc->model == NULL)
                return;
-       if ((strncmp(desc->vendor,"0x",2) || strncmp(desc->model,"0x",2) ))
+       if ((strncmp(desc->vendor,"0x",2) != 0 || strncmp(desc->model,"0x",2) ))
                return;
 
        errno = 0;
index 79b94dc7589d557c8c004f3e841ee1013f67d287..d6c3f2e837975558e4bd94228fe3226891f6e77a 100644 (file)
@@ -277,7 +277,7 @@ lookup(char *line, char *pattern, char **value)
                return 0;
 
        /* pattern */
-       if (strncmp(line, pattern, len))
+       if (strncmp(line, pattern, len) != 0)
                return 0;
 
        /* white spaces */
@@ -322,7 +322,7 @@ lookup_cache(char *line, struct lscpu_desc *desc)
        int level;
 
        /* Make sure line starts with "cache<nr> :" */
-       if (strncmp(line, "cache", 5))
+       if (strncmp(line, "cache", 5) != 0)
                return 0;
        for (p = line + 5; isdigit(*p); p++);
        for (; isspace(*p); p++);
index a1272ae6098e4c1626eca4c860c25ce07290e90c..45775d993c5314a0dd09433f1cb60bd18b918846 100644 (file)
@@ -344,7 +344,7 @@ static int memory_block_get_node(struct lsmem *lsmem, char *name)
 
        node = -1;
        while ((de = readdir(dir)) != NULL) {
-               if (strncmp("node", de->d_name, 4))
+               if (strncmp("node", de->d_name, 4) != 0)
                        continue;
                if (!isdigit_string(de->d_name + 4))
                        continue;
@@ -459,7 +459,7 @@ static void read_info(struct lsmem *lsmem)
 
 static int memory_block_filter(const struct dirent *de)
 {
-       if (strncmp("memory", de->d_name, 6))
+       if (strncmp("memory", de->d_name, 6) != 0)
                return 0;
        return isdigit_string(de->d_name + 6);
 }
index 1a2ae1b68ccce9645643f24632c5174911ab6841..cb4b0815756531914f8af74911fb488282610259 100644 (file)
@@ -262,12 +262,12 @@ static void verify_arch_domain(struct arch_domain *dom, const char *wanted)
                return;
 
        uname(&un);
-       if (strcmp(un.machine, dom->result_arch)) {
-               if (strcmp(dom->result_arch, "i386")
-                   || (strcmp(un.machine, "i486")
+       if (strcmp(un.machine, dom->result_arch) != 0) {
+               if (strcmp(dom->result_arch, "i386") != 0
+                   || (strcmp(un.machine, "i486") != 0
                        && strcmp(un.machine, "i586")
-                       && strcmp(un.machine, "i686")
-                       && strcmp(un.machine, "athlon")))
+                       && strcmp(un.machine, "i686") != 0
+                       && strcmp(un.machine, "athlon") != 0))
                        errx(EXIT_FAILURE, _("Kernel cannot set architecture to %s"), wanted);
        }
 }
index f88a8da5152473d7c75c23bce7887a29983bf2e5..861a56d1261e23ffcf69d74b572fe97757fa0414 100644 (file)
@@ -580,7 +580,7 @@ static char *replace_u(char *str, char *username)
                size_t sz;
                char *tp, *old = entry;
 
-               if (memcmp(p, "\\u", 2)) {
+               if (memcmp(p, "\\u", 2) != 0) {
                        p++;
                        continue;       /* no \u */
                }
@@ -1732,7 +1732,7 @@ static int issuedir_filter(const struct dirent *d)
 
        namesz = strlen(d->d_name);
        if (!namesz || namesz < ISSUEDIR_EXTSIZ + 1 ||
-           strcmp(d->d_name + (namesz - ISSUEDIR_EXTSIZ), ISSUEDIR_EXT))
+           strcmp(d->d_name + (namesz - ISSUEDIR_EXTSIZ), ISSUEDIR_EXT) != 0)
                return 0;
 
        /* Accept this */
index 90eb18c67fcd57d2aa980febe300065bcbdd1c46..50f18dcd2d231608548aaaa32b39549490d29840 100644 (file)
@@ -275,7 +275,7 @@ static void do_write(const struct write_control *ctl)
        tm = localtime(&now);
        /* print greeting */
        printf("\r\n\a\a\a");
-       if (strcmp(login, pwuid))
+       if (strcmp(login, pwuid) != 0)
                printf(_("Message from %s@%s (as %s) on %s at %02d:%02d ..."),
                       login, host, pwuid, ctl->src_tty_name,
                       tm->tm_hour, tm->tm_min);
index a063b116510277a5b9546f980250696b2ef93bc2..f51f698d2535a190e06aee2a5e185bdf91ab40f9 100644 (file)
@@ -33,7 +33,7 @@ int main(int argc, const char *argv[])
        }
 
        for (i = 0; i < sizeof(errors)/sizeof(*errors); i++) {
-               if (strcmp(errors[i].str, argv[1]))
+               if (strcmp(errors[i].str, argv[1]) != 0)
                        continue;
                puts(strerror(errors[i].error));
                return 0;
index 6399608c0cc6287d64bb9ab37d7738030c265c73..695b4724b5607310ed7f8fbf82b1afb549f29da6 100644 (file)
@@ -377,7 +377,7 @@ get(struct hexdump *hex)
                        hex->length -= n;
                if (!(need -= n)) {
                        if (vflag == ALL || vflag == FIRST ||
-                           memcmp(curp, savp, hex->blocksize)) {
+                           memcmp(curp, savp, hex->blocksize) != 0) {
                                if (vflag == DUP || vflag == FIRST)
                                        vflag = WAIT;
                                return(curp);