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;
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);