]> xenbits.xensource.com Git - libvirt.git/commitdiff
Do not ignore hidden files in /sys and /proc
authorJán Tomko <jtomko@redhat.com>
Tue, 21 Jun 2016 15:29:47 +0000 (17:29 +0200)
committerJán Tomko <jtomko@redhat.com>
Thu, 23 Jun 2016 19:58:38 +0000 (21:58 +0200)
The directories we iterate over are unlikely to contain any entries
starting with a dot, other than '.' and '..' which is already skipped
by virDirRead.

src/qemu/qemu_hostdev.c
src/storage/storage_backend_scsi.c
src/util/vircgroup.c
src/util/virnetdev.c
src/util/virpci.c
src/util/virprocess.c
src/util/virscsi.c
src/util/virusb.c
src/util/virutil.c

index 84f36159c8f25fad8818585607a20b3b43a38a87..0952767000f8703e544b61ed6f0d520472d04019 100644 (file)
@@ -115,10 +115,6 @@ qemuHostdevHostSupportsPassthroughVFIO(void)
         goto cleanup;
 
     while ((direrr = virDirRead(iommuDir, &iommuGroup, NULL)) > 0) {
-        /* skip ./ ../ */
-        if (STRPREFIX(iommuGroup->d_name, "."))
-            continue;
-
         /* assume we found a group */
         break;
     }
index b08d96096da4f21be0cea1f7cf40dce5c630cc56..d05f013ceefb4e4cfa75d62ad0e1c529f505ce16 100644 (file)
@@ -273,9 +273,6 @@ getNewStyleBlockDevice(const char *lun_path,
     }
 
     while ((direrr = virDirRead(block_dir, &block_dirent, block_path)) > 0) {
-        if (STREQLEN(block_dirent->d_name, ".", 1))
-            continue;
-
         if (VIR_STRDUP(*block_device, block_dirent->d_name) < 0)
             goto cleanup;
 
index 1fd46cc85a194d256afbb51c9e31234ad3ebc6a4..e91f5f6d4ddde4845b98452a5c0f06aceea1e929 100644 (file)
@@ -3392,7 +3392,6 @@ virCgroupRemoveRecursively(char *grppath)
     while ((direrr = virDirRead(grpdir, &ent, NULL)) > 0) {
         char *path;
 
-        if (ent->d_name[0] == '.') continue;
         if (ent->d_type != DT_DIR) continue;
 
         if (virAsprintf(&path, "%s/%s", grppath, ent->d_name) == -1) {
index 75ec484a4a0ece575fd2591e420af7669a19f8d5..2a5fe159b61feb7305677b5d5ef153b1bbbe0436 100644 (file)
@@ -3172,8 +3172,6 @@ virNetDevRDMAFeature(const char *ifname,
         goto cleanup;
 
     while (virDirRead(dirp, &dp, SYSFS_INFINIBAND_DIR) > 0) {
-        if (dp->d_name[0] == '.')
-            continue;
         if (virAsprintf(&ib_devpath, SYSFS_INFINIBAND_DIR "%s/device/resource",
                         dp->d_name) < 0)
             continue;
index 307892bddb466438ece21f1fdbfc6865f7ed9294..7273327b3c8f60d37f3580d4ef8cc08cd118a130 100644 (file)
@@ -471,10 +471,6 @@ virPCIDeviceIterDevices(virPCIDeviceIterPredicate predicate,
         virPCIDevicePtr check;
         char *tmp;
 
-        /* Ignore '.' and '..' */
-        if (entry->d_name[0] == '.')
-            continue;
-
         /* expected format: <domain>:<bus>:<slot>.<function> */
         if (/* domain */
             virStrToLong_ui(entry->d_name, &tmp, 16, &domain) < 0 || *tmp != ':' ||
@@ -2030,9 +2026,6 @@ virPCIDeviceAddressIOMMUGroupIterate(virPCIDeviceAddressPtr orig,
     while ((direrr = virDirRead(groupDir, &ent, groupPath)) > 0) {
         virPCIDeviceAddress newDev;
 
-        if (ent->d_name[0] == '.')
-            continue;
-
         if (virPCIDeviceAddressParse(ent->d_name, &newDev) < 0) {
             virReportError(VIR_ERR_INTERNAL_ERROR,
                            _("Found invalid device link '%s' in '%s'"),
index b0ca1ce38af06656e1be786a90a2bea9f1cf4464..5541a4f1cc488b0d523efb3205e1066acedc25bc 100644 (file)
@@ -619,10 +619,6 @@ int virProcessGetPids(pid_t pid, size_t *npids, pid_t **pids)
         long long tmp;
         pid_t tmp_pid;
 
-        /* Skip . and .. */
-        if (STRPREFIX(ent->d_name, "."))
-            continue;
-
         if (virStrToLong_ll(ent->d_name, NULL, 10, &tmp) < 0)
             goto cleanup;
         tmp_pid = tmp;
index 72a56614a3eedf9ba668c30c12d0edb2b0e6b715..ec5e017883025e7557619dd84b57283dd99a4c96 100644 (file)
@@ -134,9 +134,6 @@ virSCSIDeviceGetSgName(const char *sysfs_prefix,
     }
 
     while (virDirRead(dir, &entry, path) > 0) {
-        if (entry->d_name[0] == '.')
-            continue;
-
         /* Assume a single directory entry */
         ignore_value(VIR_STRDUP(sg, entry->d_name));
         break;
@@ -180,9 +177,6 @@ virSCSIDeviceGetDevName(const char *sysfs_prefix,
     }
 
     while (virDirRead(dir, &entry, path) > 0) {
-        if (entry->d_name[0] == '.')
-            continue;
-
         ignore_value(VIR_STRDUP(name, entry->d_name));
         break;
     }
index 33b188e624884c47013b6605933b4f1fcb2d706b..5a95dcb5a195358f137fd20a058618ea23226fa7 100644 (file)
@@ -150,7 +150,7 @@ virUSBDeviceSearch(unsigned int vendor,
         unsigned int found_prod, found_vend, found_bus, found_devno;
         char *tmpstr = de->d_name;
 
-        if (de->d_name[0] == '.' || strchr(de->d_name, ':'))
+        if (strchr(de->d_name, ':'))
             continue;
 
         if (virUSBSysReadFile("idVendor", de->d_name,
index a6c1273fd27cd4e1a79ec7dff7645c03b8b8f5a5..1bd7db82cee488d8a2ebb45933ef1dc35ba74bc0 100644 (file)
@@ -1868,7 +1868,7 @@ virFindSCSIHostByPCI(const char *sysfs_prefix,
     }
 
     while (virDirRead(dir, &entry, prefix) > 0) {
-        if (entry->d_name[0] == '.' || !virFileIsLink(entry->d_name))
+        if (!virFileIsLink(entry->d_name))
             continue;
 
         if (virAsprintf(&host_link, "%s/%s", prefix, entry->d_name) < 0)
@@ -2218,9 +2218,6 @@ virGetFCHostNameByWWN(const char *sysfs_prefix,
     } while (0)
 
     while (virDirRead(dir, &entry, prefix) > 0) {
-        if (entry->d_name[0] == '.')
-            continue;
-
         if (virAsprintf(&wwnn_path, "%s/%s/node_name", prefix,
                         entry->d_name) < 0)
             goto cleanup;
@@ -2303,9 +2300,6 @@ virFindFCHostCapableVport(const char *sysfs_prefix)
         unsigned int host;
         char *p = NULL;
 
-        if (entry->d_name[0] == '.')
-            continue;
-
         p = entry->d_name + strlen("host");
         if (virStrToLong_ui(p, NULL, 10, &host) == -1) {
             VIR_DEBUG("Failed to parse host number from '%s'",