Thanks to visit codestin.com Credit goes to github.com
We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 236aa0a commit fd81246Copy full SHA for fd81246
1 file changed
Lib/multiprocessing/connection.py
@@ -16,7 +16,6 @@
16
import sys
17
import socket
18
import struct
19
-import tempfile
20
import time
21
22
@@ -77,7 +76,11 @@ def arbitrary_address(family):
77
76
if family == 'AF_INET':
78
return ('localhost', 0)
79
elif family == 'AF_UNIX':
80
- return tempfile.mktemp(prefix='sock-', dir=util.get_temp_dir())
+ # NOTE: util.get_temp_dir() is a 0o700 per-process directory. A
+ # mktemp-style ToC vs ToU concern is not important; bind() surfaces
81
+ # the extremely unlikely collision as EADDRINUSE.
82
+ return os.path.join(util.get_temp_dir(),
83
+ f'sock-{os.urandom(6).hex()}')
84
elif family == 'AF_PIPE':
85
return (r'\\.\pipe\pyc-%d-%d-%s' %
86
(os.getpid(), next(_mmap_counter), os.urandom(8).hex()))
0 commit comments