tags 390433 + patch
thanks

Patch attached.


Regards,

-- 
Chris Lamb, UK                                       [EMAIL PROTECTED]
                                                            GPG: 0x634F9A20
diff -urNad dash-0.5.4.orig/src/trap.c dash-0.5.4/src/trap.c
--- dash-0.5.4.orig/src/trap.c  2008-06-11 03:51:32.000000000 +0100
+++ dash-0.5.4/src/trap.c       2008-06-11 03:54:32.000000000 +0100
@@ -67,6 +67,8 @@
 #define S_HARD_IGN 4           /* signal is ignored permenantly */
 #define S_RESET 5              /* temporary - to reset a hard ignored sig */
 
+#define SIGEXIT 0
+#define DUMMY_ACTION savestr(":")
 
 /* trap handler commands */
 char *trap[NSIG];
@@ -97,7 +99,7 @@
 {
        char *action;
        char **ap;
-       int signo;
+       int signo, dummysig;
 
        nextopt(nullstr);
        ap = argptr;
@@ -122,16 +124,32 @@
                        sh_error("%s: bad trap", *ap);
                INTOFF;
                if (action) {
-                       if (action[0] == '-' && action[1] == '\0')
-                               action = NULL;
-                       else
+                       if (action[0] == '-' && action[1] == '\0') {
+                               if (signo != SIGEXIT && trap[0] != NULL)
+                                       /* Reset dummy handler */
+                                       action = DUMMY_ACTION;          
+                               else
+                                       action = NULL;
+                       } else {
                                action = savestr(action);
+                       }
+               } else {
+                       action = DUMMY_ACTION;
                }
                if (trap[signo])
                        ckfree(trap[signo]);
                trap[signo] = action;
-               if (signo != 0)
+               if (signo == SIGEXIT) {
+                       /* Set dummy handlers */
+                       for (dummysig = 1 ; dummysig < NSIG ; dummysig++) {
+                               if (trap[dummysig] == NULL) {
+                                       trap[dummysig] = DUMMY_ACTION;
+                                       setsignal(dummysig);
+                               }
+                       }
+               } else {
                        setsignal(signo);
+               }
                INTON;
                ap++;
        }

Attachment: signature.asc
Description: PGP signature

Reply via email to