mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-22 04:25:18 +00:00
Do not check for '.' and '..' after virDirRead
It skips those directory entries.
This commit is contained in:
parent
7cecfba139
commit
fe79c3f2c1
@ -980,9 +980,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;
|
||||
|
||||
|
@ -530,10 +530,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;
|
||||
|
@ -3637,10 +3637,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;
|
||||
|
||||
@ -3964,10 +3960,6 @@ int virCgroupSetOwner(virCgroupPtr cgroup,
|
||||
}
|
||||
|
||||
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;
|
||||
|
||||
|
@ -951,10 +951,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;
|
||||
|
@ -2701,10 +2701,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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user