Skip to content

Commit

Permalink
utils: convert to strequal()
Browse files Browse the repository at this point in the history
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
  • Loading branch information
Christian Brauner committed Feb 26, 2021
1 parent 3721e64 commit 55056c2
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/lxc/utils.c
Expand Up @@ -709,7 +709,7 @@ bool detect_ramfs_rootfs(void)
if (strequal(p + 1, "/")) {
/* This is '/'. Is it the ramfs? */
p = strchr(p2 + 1, '-');
if (p && strncmp(p, "- rootfs ", 9) == 0)
if (p && strnequal(p, "- rootfs ", 9))
return true;
}
}
Expand Down Expand Up @@ -924,7 +924,7 @@ static bool is_subdir(const char *subdir, const char *dir, size_t len)
if (subdirlen < len)
return false;

if (strncmp(subdir, dir, len) != 0)
if (!strnequal(subdir, dir, len))
return false;

if (dir[len-1] == '/')
Expand Down Expand Up @@ -1276,7 +1276,7 @@ bool task_blocks_signal(pid_t pid, int signal)
while (getline(&line, &n, f) != -1) {
char *numstr;

if (strncmp(line, "SigBlk:", 7))
if (!strnequal(line, "SigBlk:", 7))
continue;

numstr = lxc_trim_whitespace_in_place(line + 7);
Expand Down Expand Up @@ -1382,7 +1382,7 @@ static int lxc_get_unused_loop_dev_legacy(char *loop_name)
}

while ((dp = readdir(dir))) {
if (strncmp(dp->d_name, "loop", 4) != 0)
if (!strnequal(dp->d_name, "loop", 4))
continue;

dfd = dirfd(dir);
Expand Down Expand Up @@ -1687,7 +1687,7 @@ static int process_dead(/* takes */ int status_fd)
while (getline(&line, &n, f) != -1) {
char *state;

if (strncmp(line, "State:", 6))
if (!strnequal(line, "State:", 6))
continue;

state = lxc_trim_whitespace_in_place(line + 6);
Expand Down

0 comments on commit 55056c2

Please sign in to comment.