This is the mail archive of the cygwin-developers@cygwin.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

proposed change to spawnve() signal behavior


Is the below patch acceptable?  If I understand the code correctly,
it should copy SIG_IGN to spawned children.

This is a fix for a ksh93 problem -- compiling it to use spawnve() instead
of fork() causes shell script malfunctions because children do not inherit
the parent's signal handler settings.

The ksh93 code assumes that spawnve() inherits signal handler settings.
As far as I can tell, there is no real spec for spawnve(), it is non-standard
across platforms, so I don't think this breaks any standards...
--
Joe Buehler

--- winsup/cygwin/exceptions.cc	2003-02-11 10:11:14.000000000 -0500
+++ winsup/cygwin/exceptions.cc	2003-03-19 08:34:42.000000000 -0500
@@ -738,15 +738,15 @@
 void __stdcall
 signal_fixup_after_exec (bool isspawn)
 {
   /* Set up child's signal handlers */
   for (int i = 0; i < NSIG; i++)
     {
       myself->getsig (i).sa_mask = 0;
-      if (myself->getsig (i).sa_handler != SIG_IGN || isspawn)
+      if (myself->getsig (i).sa_handler != SIG_IGN)
 	myself->getsig (i).sa_handler = SIG_DFL;
     }
 }

 static int interrupt_on_return (sigthread *, int, void *, struct sigaction&) __attribute__((regparm(3)));
 static int
 interrupt_on_return (sigthread *th, int sig, void *handler, struct sigaction& siga)


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]