archive: Check existance of the directory before rmdir

If the code path using os.renames is used, the directory would be
removed. So check the existance of it before calling rmdir.
This commit is contained in:
Fatih Aşıcı
2011-09-07 11:13:58 +00:00
parent ed2ce9bac6
commit 844b98643f
+2 -1
View File
@@ -319,7 +319,8 @@ class ArchiveTar(ArchiveBase):
os.renames(old_path, new_path)
os.rmdir(tarinfo.name)
if os.path.exists(tarinfo.name):
os.rmdir(tarinfo.name)
elif not os.path.lexists(tarinfo.linkname):
# Symlink target does not exist. Assume the old