tcsh/tcsh-6.14.00-sigint.patch
Miloslav Trmac 5533df3a65 - Fix a crash when reading scripts with multibyte characters (#183267)
- Block SIGINT while waiting for children (#177366)
2006-03-18 03:19:31 +00:00

61 lines
1.6 KiB
Diff

--- tcsh-6.14.00/sh.proc.c.sigint 2006-02-19 05:07:32.000000000 +0100
+++ tcsh-6.14.00/sh.proc.c 2006-02-19 05:29:52.000000000 +0100
@@ -543,9 +543,7 @@
{
struct process *fp;
int jobflags, reason;
-#ifdef BSDSIGS
- sigmask_t omask;
-#endif /* BSDSIGS */
+ sigset_t omask, pause_mask;
#ifdef UNRELSIGS
signalfun_t inthandler;
#endif /* UNRELSIGS */
@@ -562,17 +560,16 @@
* target process, or any of its friends, are running
*/
fp = pp;
-#ifdef BSDSIGS
- omask = sigblock(sigmask(SIGCHLD));
-#endif /* BSDSIGS */
+ sigprocmask(SIG_BLOCK, NULL, &omask);
+ sighold(SIGINT);
+ sigprocmask(SIG_BLOCK, NULL, &pause_mask);
+ sighold(SIGCHLD);
+ sigdelset(&pause_mask, SIGCHLD);
#ifdef UNRELSIGS
if (setintr)
inthandler = signal(SIGINT, SIG_IGN);
#endif /* UNRELSIGS */
for (;;) {
-#ifndef BSDSIGS
- (void) sighold(SIGCHLD);
-#endif /* !BSDSIGS */
jobflags = 0;
do
jobflags |= fp->p_flags;
@@ -583,21 +580,12 @@
xprintf("%d starting to sigpause for SIGCHLD on %d\n",
getpid(), fp->p_procid);
#endif /* JOBDEBUG */
-#ifdef BSDSIGS
- /* (void) sigpause(sigblock((sigmask_t) 0) &~ sigmask(SIGCHLD)); */
- (void) sigpause(omask & ~sigmask(SIGCHLD));
-#else /* !BSDSIGS */
- (void) sigpause(SIGCHLD);
-#endif /* !BSDSIGS */
+ sigsuspend(&pause_mask);
}
#ifdef JOBDEBUG
xprintf("%d returned from sigpause loop\n", getpid());
#endif /* JOBDEBUG */
-#ifdef BSDSIGS
- (void) sigsetmask(omask);
-#else /* !BSDSIGS */
- (void) sigrelse(SIGCHLD);
-#endif /* !BSDSIGS */
+ sigprocmask(SIG_SETMASK, &omask, NULL);
#ifdef UNRELSIGS
if (setintr)
(void) signal(SIGINT, inthandler);