_exit or exit following fork?

Don Libes libes at nbs-amrf.UUCP
Sun May 19 10:12:48 AEST 1985


I've been hacking on news 2.10.2 and I have one problem I don't know
what to do with.  In visual.c there is a routine called prun() that
actually performs the fork&exec's to do mail, followups and random
shell commands.  I've extracted the part that is pertinent:

prun()
{
	if ((pid = fork()) == 0) {
 		/* exec */		/* child */
		exit(-1);
	} else wait(pid);		/* parent */
}

If I run this piece of code, the parent gets totally screwed up.  If I
change the exit to _exit, it works fine!

All I can conjecture is that the fork is doing a vfork and the exit()
is closing some of the parents fds.  If I actually exec something in
the fork, however, ps says a new process really does exist.  In any
case, the exec'd process itself terminates with an exit, so once again,
my process gets screwed.  Any ideas?

Don Libes	{seismo,umcp-cs}!nbs-amrf!libes



More information about the Comp.os.eunice mailing list