utils: convert to strequal()

parent 5ef86378
...@@ -80,8 +80,8 @@ static int _recursive_rmdir(const char *dirname, dev_t pdev, ...@@ -80,8 +80,8 @@ static int _recursive_rmdir(const char *dirname, dev_t pdev,
int rc; int rc;
struct stat mystat; struct stat mystat;
if (!strcmp(direntp->d_name, ".") || if (strequal(direntp->d_name, ".") ||
!strcmp(direntp->d_name, "..")) strequal(direntp->d_name, ".."))
continue; continue;
rc = strnprintf(pathname, sizeof(pathname), "%s/%s", dirname, direntp->d_name); rc = strnprintf(pathname, sizeof(pathname), "%s/%s", dirname, direntp->d_name);
...@@ -91,7 +91,7 @@ static int _recursive_rmdir(const char *dirname, dev_t pdev, ...@@ -91,7 +91,7 @@ static int _recursive_rmdir(const char *dirname, dev_t pdev,
continue; continue;
} }
if (!level && exclude && !strcmp(direntp->d_name, exclude)) { if (!level && exclude && strequal(direntp->d_name, exclude)) {
ret = rmdir(pathname); ret = rmdir(pathname);
if (ret < 0) { if (ret < 0) {
switch (errno) { switch (errno) {
...@@ -625,7 +625,7 @@ bool is_shared_mountpoint(const char *path) ...@@ -625,7 +625,7 @@ bool is_shared_mountpoint(const char *path)
continue; continue;
*slider2 = '\0'; *slider2 = '\0';
if (strcmp(slider1 + 1, path) == 0) { if (strequal(slider1 + 1, path)) {
/* This is the path. Is it shared? */ /* This is the path. Is it shared? */
slider1 = strchr(slider2 + 1, ' '); slider1 = strchr(slider2 + 1, ' ');
if (slider1 && strstr(slider1, "shared:")) if (slider1 && strstr(slider1, "shared:"))
...@@ -706,7 +706,7 @@ bool detect_ramfs_rootfs(void) ...@@ -706,7 +706,7 @@ bool detect_ramfs_rootfs(void)
if (!p2) if (!p2)
continue; continue;
*p2 = '\0'; *p2 = '\0';
if (strcmp(p + 1, "/") == 0) { if (strequal(p + 1, "/")) {
/* This is '/'. Is it the ramfs? */ /* This is '/'. Is it the ramfs? */
p = strchr(p2 + 1, '-'); p = strchr(p2 + 1, '-');
if (p && strncmp(p, "- rootfs ", 9) == 0) if (p && strncmp(p, "- rootfs ", 9) == 0)
...@@ -1305,8 +1305,8 @@ int lxc_preserve_ns(const int pid, const char *ns) ...@@ -1305,8 +1305,8 @@ int lxc_preserve_ns(const int pid, const char *ns)
* string. * string.
*/ */
ret = strnprintf(path, sizeof(path), "/proc/%d/ns%s%s", pid, ret = strnprintf(path, sizeof(path), "/proc/%d/ns%s%s", pid,
!ns || strcmp(ns, "") == 0 ? "" : "/", !ns || strequal(ns, "") ? "" : "/",
!ns || strcmp(ns, "") == 0 ? "" : ns); !ns || strequal(ns, "") ? "" : ns);
if (ret < 0) if (ret < 0)
return ret_errno(EIO); return ret_errno(EIO);
...@@ -1629,7 +1629,7 @@ bool lxc_nic_exists(char *nic) ...@@ -1629,7 +1629,7 @@ bool lxc_nic_exists(char *nic)
int ret; int ret;
struct stat sb; struct stat sb;
if (!strcmp(nic, "none")) if (strequal(nic, "none"))
return true; return true;
ret = strnprintf(path, sizeof(path), "/sys/class/net/%s", nic); ret = strnprintf(path, sizeof(path), "/sys/class/net/%s", nic);
...@@ -1740,8 +1740,8 @@ int lxc_rm_rf(const char *dirname) ...@@ -1740,8 +1740,8 @@ int lxc_rm_rf(const char *dirname)
__do_free char *pathname = NULL; __do_free char *pathname = NULL;
struct stat mystat; struct stat mystat;
if (!strcmp(direntp->d_name, ".") || if (strequal(direntp->d_name, ".") ||
!strcmp(direntp->d_name, "..")) strequal(direntp->d_name, ".."))
continue; continue;
pathname = must_make_path(dirname, direntp->d_name, NULL); pathname = must_make_path(dirname, direntp->d_name, NULL);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment