Catching termination of child process and system() call

Vasile R. Montan vrm at cathedral.cerc.wvu.wvnet.edu
Tue Jan 22 06:18:03 AEST 1991


   I have a program which occasionally forks to do some processing.
In order to avoid having zombie process hang around, I put the
following in my main routine:

void dowait()
{
  wait(0);
}

main()
{
   ...
   signal(SIGCHLD, dowait);
   ...
}

   However, in another place in the code, I do a system call and look
at the return status to see if an error has occurred.  Without the
signal in the main routine, the system call works fine, but with the
signal, the system call always returns a -1.  Is there an easy way
to fix this?

**************** The above opinions are mine, all mine. *****************
Vasile R. Montan                           Bell Atlantic Software Systems 
                                           9 South High Street             
vrm at cerc.wvu.wvnet.edu                     Morgantown, WV 26505            



More information about the Comp.unix.programmer mailing list