Trouble killing processes in SysV/AT

Richard A. O'Keefe ok at quintus.UUCP
Sat May 14 18:39:05 AEST 1988


In article <97 at lakart.UUCP>, dg at lakart.UUCP (David Goodenough) writes:
> P.S. In response to all those that replied to my questions Re: <defunct>
> processes, I discover the solution is simple. After every fclose(fp), where
> fp is the FILE * I got from popen, I do a wait(&j), and the zombies go away.
> Just like sprinkling holy water on them :-). Thanks to all who replied.

Surely there is some mistake here?  FILE*s returned by popen() are ONLY
supposed to be closed by pclose().  To quote the manual:
     A stream opened by popen should be closed by pclose, which
     waits for the associated process to terminate and returns
     the exit status of the command.
NEVER close popen()ed files with fclose()!



More information about the Comp.unix.wizards mailing list