summaryrefslogtreecommitdiff
path: root/lang/python23-nth/patches/patch-ca
diff options
context:
space:
mode:
Diffstat (limited to 'lang/python23-nth/patches/patch-ca')
-rw-r--r--lang/python23-nth/patches/patch-ca54
1 files changed, 54 insertions, 0 deletions
diff --git a/lang/python23-nth/patches/patch-ca b/lang/python23-nth/patches/patch-ca
new file mode 100644
index 00000000000..fa17ad87619
--- /dev/null
+++ b/lang/python23-nth/patches/patch-ca
@@ -0,0 +1,54 @@
+$NetBSD: patch-ca,v 1.1.1.1 2005/01/23 22:57:21 recht Exp $
+
+--- Python/pythonrun.c.orig 2004-03-23 07:41:47.000000000 +1100
++++ Python/pythonrun.c
+@@ -1581,13 +1581,13 @@ initsigs(void)
+ {
+ #ifdef HAVE_SIGNAL_H
+ #ifdef SIGPIPE
+- signal(SIGPIPE, SIG_IGN);
++ PyOS_setsig(SIGPIPE, SIG_IGN);
+ #endif
+ #ifdef SIGXFZ
+- signal(SIGXFZ, SIG_IGN);
++ PyOS_setsig(SIGXFZ, SIG_IGN);
+ #endif
+ #ifdef SIGXFSZ
+- signal(SIGXFSZ, SIG_IGN);
++ PyOS_setsig(SIGXFSZ, SIG_IGN);
+ #endif
+ #endif /* HAVE_SIGNAL_H */
+ PyOS_InitInterrupts(); /* May imply initsignal() */
+@@ -1684,20 +1684,19 @@ PyOS_sighandler_t
+ PyOS_setsig(int sig, PyOS_sighandler_t handler)
+ {
+ #ifdef HAVE_SIGACTION
+- struct sigaction context;
+- PyOS_sighandler_t oldhandler;
+- /* Initialize context.sa_handler to SIG_ERR which makes about as
+- * much sense as anything else. It should get overwritten if
+- * sigaction actually succeeds and otherwise we avoid an
+- * uninitialized memory read.
+- */
+- context.sa_handler = SIG_ERR;
+- sigaction(sig, NULL, &context);
+- oldhandler = context.sa_handler;
++ struct sigaction context, ocontext;
+ context.sa_handler = handler;
+- sigaction(sig, &context, NULL);
+- return oldhandler;
++ sigemptyset(&context.sa_mask);
++ context.sa_flags = 0;
++ if (sigaction(sig, &context, &ocontext) == -1)
++ return SIG_ERR;
++ return ocontext.sa_handler;
+ #else
+- return signal(sig, handler);
++ PyOS_sighandler_t oldhandler;
++ oldhandler = signal(sig, handler);
++#ifdef HAVE_SIGINTERRUPT
++ siginterrupt(sig, 1);
++#endif
++ return oldhandler;
+ #endif
+ }