]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
tools: lxc-top: fix coding style of strncmp
author2xsec <dh48.jeong@samsung.com>
Sun, 1 Jul 2018 13:51:59 +0000 (22:51 +0900)
committer2xsec <dh48.jeong@samsung.com>
Sun, 1 Jul 2018 13:51:59 +0000 (22:51 +0900)
Signed-off-by: 2xsec <dh48.jeong@samsung.com>
src/lxc/tools/lxc_top.c

index 67ae0d660648a3c165f1795a47d744b05fab32ca..b873be640ed36894c46ab5e56f561830984cb1b3 100644 (file)
@@ -252,7 +252,7 @@ static uint64_t stat_match_get_int(struct lxc_container *c, const char *item,
 
        matchlen = strlen(match);
        for (i = 0; lines[i]; i++) {
-               if (!strncmp(lines[i], match, matchlen)) {
+               if (strncmp(lines[i], match, matchlen) == 0) {
                        cols = lxc_string_split_and_trim(lines[i], ' ');
                        if (!cols)
                                goto err1;
@@ -317,12 +317,12 @@ static void stat_get_blk_stats(struct lxc_container *c, const char *item,
                if (!cols)
                        goto out;
 
-               if (!strncmp(cols[1], "Read", strlen(cols[1])))
+               if (strncmp(cols[1], "Read", strlen(cols[1])) == 0)
                        stats->read += strtoull(cols[2], NULL, 0);
-               else if (!strncmp(cols[1], "Write", strlen(cols[1])))
+               else if (strncmp(cols[1], "Write", strlen(cols[1])) == 0)
                        stats->write += strtoull(cols[2], NULL, 0);
 
-               if (!strncmp(cols[0], "Total", strlen(cols[0])))
+               if (strncmp(cols[0], "Total", strlen(cols[0])) == 0)
                        stats->total = strtoull(cols[1], NULL, 0);
 
                lxc_free_array((void **)cols, free);