Changeset 3435 for trunk/src/kash/trap.c
- Timestamp:
- Sep 2, 2020, 10:30:54 PM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/kash/trap.c
r3409 r3435 187 187 188 188 if (signo != 0) 189 setsignal(psh, signo , 0);189 setsignal(psh, signo); 190 190 INTON; 191 191 ap++; … … 203 203 204 204 void 205 clear_traps(shinstance *psh , int vforked)205 clear_traps(shinstance *psh) 206 206 { 207 207 char **tp; … … 210 210 if (*tp && **tp) { /* trap not NULL or SIG_IGN */ 211 211 INTOFF; 212 if (!vforked) { 213 ckfree(psh, *tp); 214 *tp = NULL; 215 } 212 ckfree(psh, *tp); 213 *tp = NULL; 216 214 if (tp != &psh->trap[0]) 217 setsignal(psh, (int)(tp - psh->trap) , vforked);215 setsignal(psh, (int)(tp - psh->trap)); 218 216 INTON; 219 217 } … … 229 227 230 228 void 231 setsignal(shinstance *psh, int signo , int vforked)229 setsignal(shinstance *psh, int signo) 232 230 { 233 231 int action; … … 241 239 else 242 240 action = S_IGN; 243 if (psh->rootshell && !vforked &&action == S_DFL) {241 if (psh->rootshell && action == S_DFL) { 244 242 switch (signo) { 245 243 case SIGINT: … … 298 296 case S_IGN: sigact = SH_SIG_IGN; break; 299 297 } 300 if (!vforked) 301 *t = action; 298 *t = action; 302 299 sh_siginterrupt(psh, signo, 1); 303 300 sh_signal(psh, signo, sigact); … … 323 320 324 321 void 325 ignoresig(shinstance *psh, int signo , int vforked)322 ignoresig(shinstance *psh, int signo) 326 323 { 327 324 if (psh->sigmode[signo - 1] != S_IGN && psh->sigmode[signo - 1] != S_HARD_IGN) { 328 325 sh_signal(psh, signo, SH_SIG_IGN); 329 326 } 330 if (!vforked) 331 psh->sigmode[signo - 1] = S_HARD_IGN; 327 psh->sigmode[signo - 1] = S_HARD_IGN; 332 328 } 333 329 … … 340 336 char *sm; 341 337 342 clear_traps(psh , 0);338 clear_traps(psh); 343 339 for (sm = psh->sigmode ; sm < psh->sigmode + NSIG ; sm++) { 344 340 if (*sm == S_IGN) … … 409 405 if (on == is_interactive) 410 406 return; 411 setsignal(psh, SIGINT , 0);412 setsignal(psh, SIGQUIT , 0);413 setsignal(psh, SIGTERM , 0);407 setsignal(psh, SIGINT); 408 setsignal(psh, SIGQUIT); 409 setsignal(psh, SIGTERM); 414 410 is_interactive = on; 415 411 }
Note:
See TracChangeset
for help on using the changeset viewer.