mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-11 15:27:47 +00:00
qemuDomainBuildNamespace: Try harder to remove temp directories
If building namespace fails somewhere in the middle (that is some files exists under devMountsSavePath[i]), then plain rmdir() is not enough to remove dir. Umount the temp location and use virFileDeleteTree() to remove the directory. Signed-off-by: Michal Privoznik <mprivozn@redhat.com> Reviewed-by: Pavel Mores <pmores@redhat.com>
This commit is contained in:
parent
6bc746d66d
commit
ca2edd678d
@ -15311,9 +15311,12 @@ qemuDomainBuildNamespace(virQEMUDriverConfigPtr cfg,
|
|||||||
ret = 0;
|
ret = 0;
|
||||||
cleanup:
|
cleanup:
|
||||||
for (i = 0; i < ndevMountsPath; i++) {
|
for (i = 0; i < ndevMountsPath; i++) {
|
||||||
|
#if defined(__linux__)
|
||||||
|
umount(devMountsSavePath[i]);
|
||||||
|
#endif /* defined(__linux__) */
|
||||||
/* The path can be either a regular file or a dir. */
|
/* The path can be either a regular file or a dir. */
|
||||||
if (virFileIsDir(devMountsSavePath[i]))
|
if (virFileIsDir(devMountsSavePath[i]))
|
||||||
rmdir(devMountsSavePath[i]);
|
virFileDeleteTree(devMountsSavePath[i]);
|
||||||
else
|
else
|
||||||
unlink(devMountsSavePath[i]);
|
unlink(devMountsSavePath[i]);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user