[Python-checkins] r80864 - python/branches/signalfd-issue8407/Modules/signalmodule.c

jean-paul.calderone python-checkins at python.org
Thu May 6 05:33:18 CEST 2010


Author: jean-paul.calderone
Date: Thu May 6 05:33:18 2010
New Revision: 80864
Log:
Check `how` ourselves; pthread_sigmask appears not to
Modified:
 python/branches/signalfd-issue8407/Modules/signalmodule.c
Modified: python/branches/signalfd-issue8407/Modules/signalmodule.c
==============================================================================
--- python/branches/signalfd-issue8407/Modules/signalmodule.c	(original)
+++ python/branches/signalfd-issue8407/Modules/signalmodule.c	Thu May 6 05:33:18 2010
@@ -506,6 +506,7 @@
 char how_buffer[1024];
 
 int how, sig;
+ int valid;
 PyObject *signals, *result, *signum;
 sigset_t mask, previous;
 
@@ -517,7 +518,12 @@
 return NULL;
 }
 
- if (PY_SIGMASK(how, &mask, &previous) == -1) {
+ /*
+ * It seems that invalid values of how are not always discovered.
+ */
+ valid = (how == SIG_BLOCK || how == SIG_UNBLOCK || how == SIG_SETMASK);
+ 
+ if (!valid || PY_SIGMASK(how, &mask, &previous) == -1) {
 PyOS_snprintf(how_buffer, sizeof(how_buffer), how_format, how);
 PyErr_SetString(PyExc_ValueError, how_buffer);
 return NULL;


More information about the Python-checkins mailing list

AltStyle によって変換されたページ (->オリジナル) /