summaryrefslogtreecommitdiff
path: root/system/ksh-openbsd/patches/linux/trap_c.diff
diff options
context:
space:
mode:
Diffstat (limited to 'system/ksh-openbsd/patches/linux/trap_c.diff')
-rw-r--r--system/ksh-openbsd/patches/linux/trap_c.diff45
1 files changed, 45 insertions, 0 deletions
diff --git a/system/ksh-openbsd/patches/linux/trap_c.diff b/system/ksh-openbsd/patches/linux/trap_c.diff
new file mode 100644
index 0000000000..10f067ff06
--- /dev/null
+++ b/system/ksh-openbsd/patches/linux/trap_c.diff
@@ -0,0 +1,45 @@
+--- ksh-openbsd_cvs/trap.c 2010-02-23 12:49:23.000000000 +0100
++++ ksh-openbsd_cvs.new/trap.c 2010-04-01 21:30:25.819238979 +0200
+@@ -5,6 +5,7 @@
+ */
+
+ #include "sh.h"
++#include "posix_signals.h" /* sys_signame[] */
+
+ Trap sigtraps[NSIG + 1];
+
+@@ -13,20 +14,29 @@ static struct sigaction Sigact_ign, Siga
+ void
+ inittraps(void)
+ {
+- int i;
++ int i, j;
+
+- /* Populate sigtraps based on sys_signame and sys_siglist. */
+- for (i = 0; i <= NSIG; i++) {
++ /* Populate sigtraps based on posix_signals.h */
++ for (i = 1; i < NSIG; i++) {
+ sigtraps[i].signal = i;
+ if (i == SIGERR_) {
+ sigtraps[i].name = "ERR";
+ sigtraps[i].mess = "Error handler";
+ } else {
+- sigtraps[i].name = sys_signame[i];
+- sigtraps[i].mess = sys_siglist[i];
++ for(j = 0; j < NSIG; j++) /* find the corresponding SIGNAL number's name in the sys_signame[] array */
++ {
++ if( sys_signame[j].val == sigtraps[i].signal ) /* we got a match */
++ {
++ sigtraps[i].name = sys_signame[j].name;
++ break;
++ }
++ }
++ sigtraps[i].mess = strsignal(sigtraps[i].signal);
+ }
+ }
++ sigtraps[SIGEXIT_].signal = SIGEXIT_;
+ sigtraps[SIGEXIT_].name = "EXIT"; /* our name for signal 0 */
++ sigtraps[SIGEXIT_].mess = "Exited";
+
+ sigemptyset(&Sigact_ign.sa_mask);
+ Sigact_ign.sa_flags = 0; /* interruptible */