Skip to content

Commit d4e5045

Browse files
committed
Use lstat; check for it
1 parent f524182 commit d4e5045

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

‎Lib/tempfile.py‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -290,7 +290,7 @@ def _resetperms(path):
290290
# True if TemporaryDirectory._rmtree() can work relative to open directories
291291
# instead of resolving paths again.
292292
_rmtree_use_dir_fd = (
293-
{_os.chmod, _os.unlink} <= _os.supports_dir_fd
293+
{_os.chmod, _os.unlink, _os.lstat} <= _os.supports_dir_fd
294294
and _os.chmod in _os.supports_fd
295295
)
296296

@@ -333,7 +333,7 @@ def _resetperms_at(name, dir_fd, path):
333333
return
334334
# If that did not work, we change by name, which is subject to a race
335335
# condition.
336-
stat = _os.stat(name, dir_fd=dir_fd, follow_symlinks=False)
336+
stat = _os.lstat(name, dir_fd=dir_fd)
337337
if not _stat.S_ISLNK(stat.st_mode):
338338
_os.chmod(name, 0o700, dir_fd=dir_fd)
339339

0 commit comments

Comments
 (0)