Index: tape.c =================================================================== RCS file: /dump/FreeBSD-CVS/src/sbin/dump/tape.c,v retrieving revision 1.27 diff -u -r1.27 tape.c --- tape.c 2 Mar 2005 02:30:08 -0000 1.27 +++ tape.c 4 Nov 2007 10:58:26 -0000 @@ -110,10 +110,6 @@ int master; /* pid of master, for sending error signals */ int tenths; /* length of tape used per block written */ static volatile sig_atomic_t caught; /* have we caught the signal to proceed? */ -static volatile sig_atomic_t ready; /* reached the lock point without having */ - /* received the SIGUSR2 signal from the prev slave? */ -static jmp_buf jmpbuf; /* where to jump to if we are ready when the */ - /* SIGUSR2 arrives from the previous slave */ int alloctape(void) @@ -686,14 +682,13 @@ proceed(int signo __unused) { - if (ready) - longjmp(jmpbuf, 1); caught++; } void enslave(void) { + sigset_t mask; int cmd[2]; int i, j; @@ -704,6 +699,10 @@ signal(SIGUSR1, tperror); /* Slave sends SIGUSR1 on tape errors */ signal(SIGUSR2, proceed); /* Slave sends SIGUSR2 to next slave */ + sigemptyset(&mask); + sigaddset(&mask, SIGUSR2); + sigprocmask(SIG_BLOCK, &mask, NULL); + for (i = 0; i < SLAVES; i++) { if (i == slp - &slaves[0]) { caught = 1; @@ -757,9 +756,11 @@ static void doslave(int cmd, int slave_number) { + sigset_t emask; int nread; int nextslave, size, wrote, eot_count; + sigemptyset(&emask); /* * Need our own seek pointer. */ @@ -793,12 +794,8 @@ quit("master/slave protocol botched.\n"); } } - if (setjmp(jmpbuf) == 0) { - ready = 1; - if (!caught) - (void) pause(); - } - ready = 0; + while (!caught) + (void) sigsuspend(&emask); caught = 0; /* Try to write the data... */