diff options
author | Steve Dower <steve.dower@python.org> | 2019-06-24 15:42:54 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-06-24 15:42:54 (GMT) |
commit | 60419a7e96577cf783b3b45bf3984f9fb0d7ddff (patch) | |
tree | 2718cb915663c42902621491ba60accce6729d42 /Lib/tempfile.py | |
parent | 9bbf4d7083a819cbcee2a6cd3df2802d4c50f734 (diff) | |
download | cpython-60419a7e96577cf783b3b45bf3984f9fb0d7ddff.zip cpython-60419a7e96577cf783b3b45bf3984f9fb0d7ddff.tar.gz cpython-60419a7e96577cf783b3b45bf3984f9fb0d7ddff.tar.bz2 |
bpo-37363: Add audit events for a range of modules (GH-14301)
Diffstat (limited to 'Lib/tempfile.py')
-rw-r--r-- | Lib/tempfile.py | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/Lib/tempfile.py b/Lib/tempfile.py index e8b111e..45709cb 100644 --- a/Lib/tempfile.py +++ b/Lib/tempfile.py @@ -43,6 +43,7 @@ import os as _os import shutil as _shutil import errno as _errno from random import Random as _Random +import sys as _sys import weakref as _weakref import _thread _allocate_lock = _thread.allocate_lock @@ -244,6 +245,7 @@ def _mkstemp_inner(dir, pre, suf, flags, output_type): for seq in range(TMP_MAX): name = next(names) file = _os.path.join(dir, pre + name + suf) + _sys.audit("tempfile.mkstemp", file) try: fd = _os.open(file, flags, 0o600) except FileExistsError: @@ -352,6 +354,7 @@ def mkdtemp(suffix=None, prefix=None, dir=None): for seq in range(TMP_MAX): name = next(names) file = _os.path.join(dir, prefix + name + suffix) + _sys.audit("tempfile.mkdtemp", file) try: _os.mkdir(file, 0o700) except FileExistsError: @@ -546,7 +549,7 @@ def NamedTemporaryFile(mode='w+b', buffering=-1, encoding=None, _os.close(fd) raise -if _os.name != 'posix' or _os.sys.platform == 'cygwin': +if _os.name != 'posix' or _sys.platform == 'cygwin': # On non-POSIX and Cygwin systems, assume that we cannot unlink a file # while it is open. TemporaryFile = NamedTemporaryFile |