static char ddate[BUFSIZ]; /* record the delivery date */
struct tws *now;
-static jmp_buf myctx;
+volatile sig_atomic_t eflag = 0; /* flag to indecate interrupt */
+static pid_t child_id;
/* flags for pair->p_flags */
#define P_NIL 0x00
default:
/* parent process */
- if (setjmp(myctx)) {
- /*
- ** Ruthlessly kill the child and anything
- ** else in its process group.
- */
- kill(-child_id, SIGKILL);
- if (verbose)
- verbose_printf(", timed-out; terminated\n");
- return -1;
- }
SIGNAL(SIGALRM, alrmser);
bytes = fstat(fd, &st) != -1 ? (int) st.st_size : 100;
status = pidwait(child_id, 0);
alarm(0);
+ if (eflag) {
+ if (verbose) {
+ verbose_printf(", timed-out; terminated\n");
+ }
+ return -1;
+ }
+
if (verbose) {
if (!status) {
verbose_printf(", success.\n");
static void
alrmser(int i)
{
- longjmp(myctx, DONE);
+ eflag = 1;
+ kill(-child_id, SIGKILL);
}