diff options
-rw-r--r-- | shell/ash.c | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/shell/ash.c b/shell/ash.c index b3ec4caf8..3a143229e 100644 --- a/shell/ash.c +++ b/shell/ash.c | |||
@@ -588,10 +588,12 @@ struct globals_misc { | |||
588 | 588 | ||
589 | /* indicates specified signal received */ | 589 | /* indicates specified signal received */ |
590 | uint8_t gotsig[NSIG - 1]; /* offset by 1: "signal" 0 is meaningless */ | 590 | uint8_t gotsig[NSIG - 1]; /* offset by 1: "signal" 0 is meaningless */ |
591 | #endif | ||
592 | uint8_t may_have_traps; /* 0: definitely no traps are set, 1: some traps may be set */ | 591 | uint8_t may_have_traps; /* 0: definitely no traps are set, 1: some traps may be set */ |
592 | #endif | ||
593 | char *trap[NSIG]; | 593 | char *trap[NSIG]; |
594 | #if !ENABLE_PLATFORM_MINGW32 | ||
594 | char **trap_ptr; /* used only by "trap hack" */ | 595 | char **trap_ptr; /* used only by "trap hack" */ |
596 | #endif | ||
595 | 597 | ||
596 | /* Rarely referenced stuff */ | 598 | /* Rarely referenced stuff */ |
597 | #if ENABLE_ASH_RANDOM_SUPPORT | 599 | #if ENABLE_ASH_RANDOM_SUPPORT |
@@ -636,12 +638,20 @@ extern struct globals_misc *BB_GLOBAL_CONST ash_ptr_to_globals_misc; | |||
636 | #define trap_ptr (G_misc.trap_ptr ) | 638 | #define trap_ptr (G_misc.trap_ptr ) |
637 | #define random_gen (G_misc.random_gen ) | 639 | #define random_gen (G_misc.random_gen ) |
638 | #define backgndpid (G_misc.backgndpid ) | 640 | #define backgndpid (G_misc.backgndpid ) |
641 | |||
642 | #if ENABLE_PLATFORM_MINGW32 | ||
643 | #undef may_have_traps | ||
644 | #undef trap_ptr | ||
645 | #define may_have_traps (0) | ||
646 | #define trap_ptr trap | ||
647 | #endif | ||
648 | |||
639 | #define INIT_G_misc() do { \ | 649 | #define INIT_G_misc() do { \ |
640 | (*(struct globals_misc**)not_const_pp(&ash_ptr_to_globals_misc)) = xzalloc(sizeof(G_misc)); \ | 650 | (*(struct globals_misc**)not_const_pp(&ash_ptr_to_globals_misc)) = xzalloc(sizeof(G_misc)); \ |
641 | barrier(); \ | 651 | barrier(); \ |
642 | curdir = nullstr; \ | 652 | curdir = nullstr; \ |
643 | physdir = nullstr; \ | 653 | physdir = nullstr; \ |
644 | trap_ptr = trap; \ | 654 | IF_NOT_PLATFORM_MINGW32(trap_ptr = trap;) \ |
645 | } while (0) | 655 | } while (0) |
646 | 656 | ||
647 | 657 | ||
@@ -14415,8 +14425,10 @@ trapcmd(int argc UNUSED_PARAM, char **argv UNUSED_PARAM) | |||
14415 | if (LONE_DASH(action)) | 14425 | if (LONE_DASH(action)) |
14416 | action = NULL; | 14426 | action = NULL; |
14417 | else { | 14427 | else { |
14428 | #if !ENABLE_PLATFORM_MINGW32 | ||
14418 | if (action[0]) /* not NULL and not "" and not "-" */ | 14429 | if (action[0]) /* not NULL and not "" and not "-" */ |
14419 | may_have_traps = 1; | 14430 | may_have_traps = 1; |
14431 | #endif | ||
14420 | action = ckstrdup(action); | 14432 | action = ckstrdup(action); |
14421 | } | 14433 | } |
14422 | } | 14434 | } |
@@ -16219,7 +16231,7 @@ forkshell_init(const char *idstr) | |||
16219 | } | 16231 | } |
16220 | fs->gmp->exception_handler = ash_ptr_to_globals_misc->exception_handler; | 16232 | fs->gmp->exception_handler = ash_ptr_to_globals_misc->exception_handler; |
16221 | memset(fs->gmp->trap, 0, sizeof(fs->gmp->trap[0])*NSIG); | 16233 | memset(fs->gmp->trap, 0, sizeof(fs->gmp->trap[0])*NSIG); |
16222 | fs->gmp->trap_ptr = fs->gmp->trap; | 16234 | /* fs->gmp->trap_ptr = fs->gmp->trap; */ |
16223 | 16235 | ||
16224 | /* Switch global variables */ | 16236 | /* Switch global variables */ |
16225 | gvpp = (struct globals_var **)&ash_ptr_to_globals_var; | 16237 | gvpp = (struct globals_var **)&ash_ptr_to_globals_var; |