summaryrefslogtreecommitdiffstats
path: root/iutil.py
diff options
context:
space:
mode:
authorJeremy Katz <katzj@redhat.com>2003-02-26 20:02:21 +0000
committerJeremy Katz <katzj@redhat.com>2003-02-26 20:02:21 +0000
commit162a2885ce0ceb1314fdf8746e31c95dcfeb9686 (patch)
tree51bfa40bd3ef9f6b0f800e8397aa9d185713189d /iutil.py
parent47d56224fa166a6f4b25d5a71bb19ebddf6e25bb (diff)
downloadanaconda-162a2885ce0ceb1314fdf8746e31c95dcfeb9686.tar.gz
anaconda-162a2885ce0ceb1314fdf8746e31c95dcfeb9686.tar.xz
anaconda-162a2885ce0ceb1314fdf8746e31c95dcfeb9686.zip
fixup to make our rmrf even better (don't follow symlinks) and add a warning
so that people don't cut and paste it for use elsewhere
Diffstat (limited to 'iutil.py')
-rw-r--r--iutil.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/iutil.py b/iutil.py
index 042b94d1c..be7168ed1 100644
--- a/iutil.py
+++ b/iutil.py
@@ -290,14 +290,16 @@ def findtz(basepath, relpath):
def rmrf (path):
# this is only the very simple case.
+ # NOTE THAT THIS IS RACY IF USED ON AN INSTALLED SYSTEM
+ # IT IS ONLY SAFE FOR ANACONDA AS A CONTAINED ENVIRONMENT
if os.path.isdir(path):
files = os.listdir (path)
else:
os.unlink(path)
return
for file in files:
- if os.path.isdir(path + '/' + file):
- rmrf (path + '/' + file)
+ if (not os.path.islink(path + '/' + file) and
+ os.path.isdir(path + '/' + file)):
else:
os.unlink (path + '/' + file)
os.rmdir (path)