提交 6ab3e2f6 编写于 作者: M Michal Privoznik

qemuDomainBuildNamespace: Clean up temp files

https://bugzilla.redhat.com/show_bug.cgi?id=1431112

After 290a00e4 we know how to deal with file mount points.
However, when cleaning up the temporary location for preserved
mount points we are still calling rmdir(). This won't fly for
files. We need to call unlink(). Now, since we don't really care
if the cleanup succeeded or not (it's the best effort anyway), we
can call both rmdir() and unlink() without need for
differentiation between files and directories.
Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
Reviewed-by: NJohn Ferlan <jferlan@redhat.com>
上级 cc9f0521
...@@ -8363,8 +8363,13 @@ qemuDomainBuildNamespace(virQEMUDriverConfigPtr cfg, ...@@ -8363,8 +8363,13 @@ qemuDomainBuildNamespace(virQEMUDriverConfigPtr cfg,
ret = 0; ret = 0;
cleanup: cleanup:
for (i = 0; i < ndevMountsPath; i++) for (i = 0; i < ndevMountsPath; i++) {
rmdir(devMountsSavePath[i]); /* The path can be either a regular file or a dir. */
if (virFileIsDir(devMountsSavePath[i]))
rmdir(devMountsSavePath[i]);
else
unlink(devMountsSavePath[i]);
}
virStringListFreeCount(devMountsPath, ndevMountsPath); virStringListFreeCount(devMountsPath, ndevMountsPath);
virStringListFreeCount(devMountsSavePath, ndevMountsPath); virStringListFreeCount(devMountsSavePath, ndevMountsPath);
return ret; return ret;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册