mirror of
https://github.com/python/cpython.git
synced 2025-11-11 14:44:57 +00:00
Issue #27781: Fixes uninitialized fd when !MS_WINDOWS and !HAVE_OPENAT
This commit is contained in:
parent
18591e4189
commit
6230aaf561
1 changed files with 3 additions and 2 deletions
|
|
@ -7477,13 +7477,14 @@ os_open_impl(PyObject *module, path_t *path, int flags, int mode, int dir_fd)
|
||||||
Py_BEGIN_ALLOW_THREADS
|
Py_BEGIN_ALLOW_THREADS
|
||||||
#ifdef MS_WINDOWS
|
#ifdef MS_WINDOWS
|
||||||
fd = _wopen(path->wide, flags, mode);
|
fd = _wopen(path->wide, flags, mode);
|
||||||
#endif
|
#else
|
||||||
#ifdef HAVE_OPENAT
|
#ifdef HAVE_OPENAT
|
||||||
if (dir_fd != DEFAULT_DIR_FD)
|
if (dir_fd != DEFAULT_DIR_FD)
|
||||||
fd = openat(dir_fd, path->narrow, flags, mode);
|
fd = openat(dir_fd, path->narrow, flags, mode);
|
||||||
else
|
else
|
||||||
|
#endif /* HAVE_OPENAT */
|
||||||
fd = open(path->narrow, flags, mode);
|
fd = open(path->narrow, flags, mode);
|
||||||
#endif
|
#endif /* !MS_WINDOWS */
|
||||||
Py_END_ALLOW_THREADS
|
Py_END_ALLOW_THREADS
|
||||||
} while (fd < 0 && errno == EINTR && !(async_err = PyErr_CheckSignals()));
|
} while (fd < 0 && errno == EINTR && !(async_err = PyErr_CheckSignals()));
|
||||||
_Py_END_SUPPRESS_IPH
|
_Py_END_SUPPRESS_IPH
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue