[PATCH 13/18] Do not check for '.' and '..' after virDirRead

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



It skips those directory entries.
---
 src/conf/virsecretobj.c     | 3 ---
 src/network/bridge_driver.c | 4 ----
 src/util/vircgroup.c        | 8 --------
 src/util/virfile.c          | 4 ----
 src/util/virpci.c           | 4 ----
 5 files changed, 23 deletions(-)

diff --git a/src/conf/virsecretobj.c b/src/conf/virsecretobj.c
index a093258..30a5e80 100644
--- a/src/conf/virsecretobj.c
+++ b/src/conf/virsecretobj.c
@@ -977,9 +977,6 @@ virSecretLoadAllConfigs(virSecretObjListPtr secrets,
         char *path;
         virSecretObjPtr secret;
 
-        if (STREQ(de->d_name, ".") || STREQ(de->d_name, ".."))
-            continue;
-
         if (!virFileHasSuffix(de->d_name, ".xml"))
             continue;
 
diff --git a/src/network/bridge_driver.c b/src/network/bridge_driver.c
index b108152..58ceaf2 100644
--- a/src/network/bridge_driver.c
+++ b/src/network/bridge_driver.c
@@ -525,10 +525,6 @@ networkMigrateStateFiles(virNetworkDriverStatePtr driver)
             entry->d_type != DT_REG)
             continue;
 
-        if (STREQ(entry->d_name, ".") ||
-            STREQ(entry->d_name, ".."))
-            continue;
-
         if (virAsprintf(&oldPath, "%s/%s",
                         oldStateDir, entry->d_name) < 0)
             goto cleanup;
diff --git a/src/util/vircgroup.c b/src/util/vircgroup.c
index da20ba5..971894a 100644
--- a/src/util/vircgroup.c
+++ b/src/util/vircgroup.c
@@ -3634,10 +3634,6 @@ virCgroupKillRecursiveInternal(virCgroupPtr group,
     }
 
     while ((direrr = virDirRead(dp, &ent, keypath)) > 0) {
-        if (STREQ(ent->d_name, "."))
-            continue;
-        if (STREQ(ent->d_name, ".."))
-            continue;
         if (ent->d_type != DT_DIR)
             continue;
 
@@ -3958,10 +3954,6 @@ int virCgroupSetOwner(virCgroupPtr cgroup,
             goto cleanup;
 
         while ((direrr = virDirRead(dh, &de, base)) > 0) {
-            if (STREQ(de->d_name, ".") ||
-                STREQ(de->d_name, ".."))
-                continue;
-
             if (virAsprintf(&entry, "%s/%s", base, de->d_name) < 0)
                 goto cleanup;
 
diff --git a/src/util/virfile.c b/src/util/virfile.c
index 2772089..a45279a 100644
--- a/src/util/virfile.c
+++ b/src/util/virfile.c
@@ -941,10 +941,6 @@ int virFileDeleteTree(const char *dir)
     while ((direrr = virDirRead(dh, &de, dir)) > 0) {
         struct stat sb;
 
-        if (STREQ(de->d_name, ".") ||
-            STREQ(de->d_name, ".."))
-            continue;
-
         if (virAsprintf(&filepath, "%s/%s",
                         dir, de->d_name) < 0)
             goto cleanup;
diff --git a/src/util/virpci.c b/src/util/virpci.c
index c497f02..948fdbf 100644
--- a/src/util/virpci.c
+++ b/src/util/virpci.c
@@ -2694,10 +2694,6 @@ virPCIGetNetName(char *device_link_sysfs_path, char **netname)
         goto out;
 
     while (virDirRead(dir, &entry, pcidev_sysfs_net_path) > 0) {
-        if (STREQ(entry->d_name, ".") ||
-            STREQ(entry->d_name, ".."))
-            continue;
-
         /* Assume a single directory entry */
         if (VIR_STRDUP(*netname, entry->d_name) > 0)
             ret = 0;
-- 
2.7.3

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]