Skip to content

Commit

Permalink
tools: lxc-top: fix coding style of strncmp
Browse files Browse the repository at this point in the history
Signed-off-by: 2xsec <dh48.jeong@samsung.com>
  • Loading branch information
2xsec authored and Christian Brauner committed Jul 2, 2018
1 parent ce31630 commit 17f5790
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/lxc/tools/lxc_top.c
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 17f5790

Please sign in to comment.