slackbuilds_ponce/system/ksh-openbsd/patches/linux/trap_c.diff
Daniel LEVAI 7fc7de8808 system/ksh-openbsd: Renamed from "ksh" and updated to 20110909
Signed-off-by: Robby Workman <rworkman@slackbuilds.org>
2011-10-08 20:29:28 -05:00

45 lines
1.3 KiB
Diff

--- 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 */