提交 fe79c3f2 编写于 作者: J Ján Tomko

Do not check for '.' and '..' after virDirRead

It skips those directory entries.
上级 7cecfba1
......@@ -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;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册