diff options
author | Nick Coghlan <ncoghlan@gmail.com> | 2012-06-24 06:43:06 (GMT) |
---|---|---|
committer | Nick Coghlan <ncoghlan@gmail.com> | 2012-06-24 06:43:06 (GMT) |
commit | 5b0eca116ad1b9509ebe4620f1685d86ce4433bf (patch) | |
tree | 06028b901fd8bd82fb14cf108c399b8626dce196 /Lib/shutil.py | |
parent | 8e5c0a774fd8c51fdf5654a6d6688a09e62d6c5e (diff) | |
download | cpython-5b0eca116ad1b9509ebe4620f1685d86ce4433bf.zip cpython-5b0eca116ad1b9509ebe4620f1685d86ce4433bf.tar.gz cpython-5b0eca116ad1b9509ebe4620f1685d86ce4433bf.tar.bz2 |
Issue #4489: Rename the feature marker for the symlink resistant rmtree and store it as a function attribute
Diffstat (limited to 'Lib/shutil.py')
-rw-r--r-- | Lib/shutil.py | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/Lib/shutil.py b/Lib/shutil.py index f743d05..2c00f4a 100644 --- a/Lib/shutil.py +++ b/Lib/shutil.py @@ -405,8 +405,9 @@ def _rmtree_safe_fd(topfd, path, onerror): except os.error: onerror(os.rmdir, path, sys.exc_info()) -rmtree_is_safe = _use_fd_functions = (os.unlink in os.supports_dir_fd and - os.open in os.supports_dir_fd) +_use_fd_functions = (os.unlink in os.supports_dir_fd and + os.open in os.supports_dir_fd) + def rmtree(path, ignore_errors=False, onerror=None): """Recursively delete a directory tree. @@ -449,6 +450,9 @@ def rmtree(path, ignore_errors=False, onerror=None): else: return _rmtree_unsafe(path, onerror) +# Allow introspection of whether or not the hardening against symlink +# attacks is supported on the current platform +rmtree.avoids_symlink_attacks = _use_fd_functions def _basename(path): # A basename() variant which first strips the trailing slash, if present. |