Changeset 3438 in kBuild for trunk/src/kash/trap.c
- Timestamp:
- Sep 9, 2020 8:01:39 PM (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/kash/trap.c
r3435 r3438 80 80 static int getsigaction(shinstance *, int, shsig_t *); 81 81 82 #ifndef SH_FORKED_MODE 83 void 84 subshellinittrap(shinstance *psh, shinstance *inherit) 85 { 86 /* The forkchild calls clear_traps(), we have to emulate that here. */ 87 unsigned i; 88 memcpy(psh->sigmode, inherit->sigmode, sizeof(psh->sigmode)); 89 for (i = 0; i < K_ELEMENTS(inherit->trap); i++) { 90 const char *src = inherit->trap[i]; 91 if (!src) { 92 } else if (i > 0) { 93 setsignal(psh, i); 94 } 95 } 96 } 97 #endif 98 99 82 100 /* 83 101 * return the signal number described by `p' (as a number or a name) … … 210 228 if (*tp && **tp) { /* trap not NULL or SIG_IGN */ 211 229 INTOFF; 212 213 230 ckfree(psh, *tp); 231 *tp = NULL; 214 232 if (tp != &psh->trap[0]) 215 233 setsignal(psh, (int)(tp - psh->trap)); … … 417 435 */ 418 436 419 SH_NORETURN_1 void 420 exitshell (shinstance *psh, int status)437 int 438 exitshell2(shinstance *psh, int status) 421 439 { 422 440 struct jmploc loc1, loc2; 423 441 char *p; 424 442 425 TRACE((psh, "pid % d, exitshell(%d)\n", sh_getpid(psh), status));443 TRACE((psh, "pid %" SHPID_PRI ", exitshell(%d)\n", sh_getpid(psh), status)); 426 444 if (setjmp(loc1.loc)) { 427 445 goto l1; … … 435 453 evalstring(psh, p, 0); 436 454 } 437 l1: psh->handler = &loc2; /* probably unnecessary */ 455 l1: 456 psh->handler = &loc2; /* probably unnecessary */ 438 457 output_flushall(psh); 439 458 #if JOBS 440 459 setjobctl(psh, 0); 441 460 #endif 442 l2: sh__exit(psh, status); 461 l2: 462 return status; 463 } 464 465 SH_NORETURN_1 void 466 exitshell(shinstance *psh, int status) 467 { 468 sh__exit(psh, exitshell2(psh, status)); 443 469 /* NOTREACHED */ 444 470 } 471
Note:
See TracChangeset
for help on using the changeset viewer.