diff options
author | Jeremy Katz <katzj@redhat.com> | 2003-02-26 20:02:21 +0000 |
---|---|---|
committer | Jeremy Katz <katzj@redhat.com> | 2003-02-26 20:02:21 +0000 |
commit | 162a2885ce0ceb1314fdf8746e31c95dcfeb9686 (patch) | |
tree | 51bfa40bd3ef9f6b0f800e8397aa9d185713189d /iutil.py | |
parent | 47d56224fa166a6f4b25d5a71bb19ebddf6e25bb (diff) | |
download | anaconda-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.py | 6 |
1 files changed, 4 insertions, 2 deletions
@@ -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) |