summaryrefslogtreecommitdiffstats
path: root/Modules/signalmodule.c
diff options
context:
space:
mode:
Diffstat (limited to 'Modules/signalmodule.c')
-rw-r--r--Modules/signalmodule.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/Modules/signalmodule.c b/Modules/signalmodule.c
index 7bc1b53..c49a3ea 100644
--- a/Modules/signalmodule.c
+++ b/Modules/signalmodule.c
@@ -664,7 +664,19 @@ signal_siginterrupt_impl(PyObject *module, int signalnum, int flag)
"signal number out of range");
return NULL;
}
- if (siginterrupt(signalnum, flag)<0) {
+#ifdef HAVE_SIGACTION
+ struct sigaction act;
+ (void) sigaction(signalnum, NULL, &act);
+ if (flag) {
+ act.sa_flags &= ~SA_RESTART;
+ }
+ else {
+ act.sa_flags |= SA_RESTART;
+ }
+ if (sigaction(signalnum, &act, NULL) < 0) {
+#else
+ if (siginterrupt(signalnum, flag) < 0) {
+#endif
PyErr_SetFromErrno(PyExc_OSError);
return NULL;
}