summaryrefslogtreecommitdiffstats
path: root/Modules/signalmodule.c
diff options
context:
space:
mode:
authorAntoine Pitrou <solipsis@pitrou.net>2013-04-17 20:06:44 (GMT)
committerAntoine Pitrou <solipsis@pitrou.net>2013-04-17 20:06:44 (GMT)
commitcf8a1e51ece7cad7096963927993ddfa738627e6 (patch)
tree236620316415785822a0cd67eec0713d8d8409f2 /Modules/signalmodule.c
parentb38897fc91c7f4b80bc2025ade219674d7b78bf3 (diff)
downloadcpython-cf8a1e51ece7cad7096963927993ddfa738627e6.zip
cpython-cf8a1e51ece7cad7096963927993ddfa738627e6.tar.gz
cpython-cf8a1e51ece7cad7096963927993ddfa738627e6.tar.bz2
- Issue #17782: Fix undefined behaviour on platforms where ``struct timespec``'s "tv_nsec" member is not a C long.
Diffstat (limited to 'Modules/signalmodule.c')
-rw-r--r--Modules/signalmodule.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/Modules/signalmodule.c b/Modules/signalmodule.c
index 41acbfa..0cc7237 100644
--- a/Modules/signalmodule.c
+++ b/Modules/signalmodule.c
@@ -784,14 +784,18 @@ signal_sigtimedwait(PyObject *self, PyObject *args)
struct timespec buf;
sigset_t set;
siginfo_t si;
+ time_t tv_sec;
+ long tv_nsec;
int err;
if (!PyArg_ParseTuple(args, "OO:sigtimedwait",
&signals, &timeout))
return NULL;
- if (_PyTime_ObjectToTimespec(timeout, &buf.tv_sec, &buf.tv_nsec) == -1)
+ if (_PyTime_ObjectToTimespec(timeout, &tv_sec, &tv_nsec) == -1)
return NULL;
+ buf.tv_sec = tv_sec;
+ buf.tv_nsec = tv_nsec;
if (buf.tv_sec < 0 || buf.tv_nsec < 0) {
PyErr_SetString(PyExc_ValueError, "timeout must be non-negative");