| # | Line 67 | Line 67 | SUBPROC *pd | |
|---|---|---|
| 67 | { | |
| 68 | int pid, status; | |
| 69 | ||
| 70 | + | if (!pd->running) |
| 71 | + | return(0); |
| 72 | close(pd->r); | |
| 73 | close(pd->w); | |
| 74 | pd->running = 0; | |
| 75 | < | while ((pid = wait(&status)) != -1) |
| 76 | < | if (pid == pd->pid) |
| 75 | < | return(status>>8 & 0xff); |
| 75 | > | if (waitpid(pd->pid, &status, 0) == pd->pid) |
| 76 | > | return(status>>8 & 0xff); |
| 77 | return(-1); /* ? unknown status */ | |
| 78 | } | |
| 79 | ||
| – | Removed lines |
| + | Added lines |
| < | Changed lines (old) |
| > | Changed lines (new) |