mirror of
https://github.com/python/cpython.git
synced 2025-09-22 16:33:26 +00:00
[3.14] gh-132124: improve safety nets for creating AF_UNIX socket files (GH-134085) (#134447)
gh-132124: improve safety nets for creating AF_UNIX socket files (GH-134085)
* ensure that we can create AF_UNIX socket files
* emit a warning if system-wide temporary directory is used
(cherry picked from commit 1a07a01014
)
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
This commit is contained in:
parent
df6d9e7fbd
commit
f8ced87fa3
4 changed files with 87 additions and 5 deletions
|
@ -180,7 +180,7 @@ def _candidate_tempdir_list():
|
|||
|
||||
return dirlist
|
||||
|
||||
def _get_default_tempdir():
|
||||
def _get_default_tempdir(dirlist=None):
|
||||
"""Calculate the default directory to use for temporary files.
|
||||
This routine should be called exactly once.
|
||||
|
||||
|
@ -190,7 +190,8 @@ def _get_default_tempdir():
|
|||
service, the name of the test file must be randomized."""
|
||||
|
||||
namer = _RandomNameSequence()
|
||||
dirlist = _candidate_tempdir_list()
|
||||
if dirlist is None:
|
||||
dirlist = _candidate_tempdir_list()
|
||||
|
||||
for dir in dirlist:
|
||||
if dir != _os.curdir:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue