*** script.c.orig 2004-02-15 09:30:13.000000000 -0800 --- script.c 2010-11-10 22:02:59.000000000 -0800 *************** *** 155,158 **** --- 155,159 ---- if (child < 0) { warn("fork"); + (void)close(master); done(1); } *************** *** 204,207 **** --- 203,207 ---- } } + (void)close(master); finish(); done(0); *************** *** 220,238 **** { pid_t pid; ! int die, e, status; ! die = e = 0; ! while ((pid = wait3(&status, WNOHANG, 0)) > 0) ! if (pid == child) { ! die = 1; ! if (WIFEXITED(status)) ! e = WEXITSTATUS(status); ! else if (WIFSIGNALED(status)) ! e = WTERMSIG(status); ! else /* can't happen */ ! e = 1; ! } ! if (die) done(e); } --- 220,235 ---- { pid_t pid; ! int e, status; ! e = 0; ! wait(&status); ! if (WIFEXITED(status)) ! e = WEXITSTATUS(status); ! else if (WIFSIGNALED(status)) ! e = WTERMSIG(status); ! else /* can't happen */ ! e = 1; ! if (e) done(e); } *************** *** 264,267 **** --- 261,265 ---- { (void)kill(0, SIGTERM); + (void)close(master); done(1); } *************** *** 280,284 **** } (void)fclose(fscript); - (void)close(master); exit(eno); } --- 278,281 ----