diff options
author | Victor Stinner <victor.stinner@gmail.com> | 2017-10-24 23:53:32 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-10-24 23:53:32 (GMT) |
commit | 850a18e03e8f8309bc8c39adc6e7d51a4568cd9a (patch) | |
tree | 56455b89cb152566734d1fc5de5c70029c3baa70 /Modules/posixmodule.c | |
parent | 3557b05c5a7dfd7d97ddfd3b79aefd53d25e5132 (diff) | |
download | cpython-850a18e03e8f8309bc8c39adc6e7d51a4568cd9a.zip cpython-850a18e03e8f8309bc8c39adc6e7d51a4568cd9a.tar.gz cpython-850a18e03e8f8309bc8c39adc6e7d51a4568cd9a.tar.bz2 |
bpo-30768: Recompute timeout on interrupted lock (GH-4103)
Fix the pthread+semaphore implementation of
PyThread_acquire_lock_timed() when called with timeout > 0 and
intr_flag=0: recompute the timeout if sem_timedwait() is interrupted
by a signal (EINTR).
See also the PEP 475.
The pthread implementation of PyThread_acquire_lock() now fails with
a fatal error if the timeout is larger than PY_TIMEOUT_MAX, as done
in the Windows implementation.
The check prevents any risk of overflow in PyThread_acquire_lock().
Add also PY_DWORD_MAX constant.
Diffstat (limited to 'Modules/posixmodule.c')
-rw-r--r-- | Modules/posixmodule.c | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c index c7d8b00..661fa13 100644 --- a/Modules/posixmodule.c +++ b/Modules/posixmodule.c @@ -390,8 +390,6 @@ static int win32_can_symlink = 0; #endif #endif -#define DWORD_MAX 4294967295U - #ifdef MS_WINDOWS #define INITFUNC PyInit_nt #define MODNAME "nt" @@ -3817,7 +3815,7 @@ os__getvolumepathname_impl(PyObject *module, PyObject *path) /* Volume path should be shorter than entire path */ buflen = Py_MAX(buflen, MAX_PATH); - if (buflen > DWORD_MAX) { + if (buflen > PY_DWORD_MAX) { PyErr_SetString(PyExc_OverflowError, "path too long"); return NULL; } |