Newsgroups: comp.unix.aix Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!van-bc!ubc-cs!alberta!cpsc.ucalgary.ca!deraadt From: deraadt@cpsc.ucalgary.ca (Theo de Raadt) Subject: Re: vfork() (was Re: RS6000 questions/comments) In-Reply-To: sef@kithrup.COM's message of 29 Jun 91 07:29:30 GMT Message-ID: Organization: U of Calgary, CompSci References: <1991Jun27.221208.14845@kithrup.COM> <8903@awdprime.UUCP> <351@devnull.mpd.tandem.com> <1991Jun29.072930.24674@kithrup.COM> Distribution: usa Date: 29 Jun 91 02:57:58 Lines: 37 In article <1991Jun29.072930.24674@kithrup.COM> sef@kithrup.COM (Sean Eric Fagan) writes: >>Also, don't forget to use _exit() (note the leading underscore '_') INSTEAD >>of exit() in the event the execve() fails so that you don't hose the parent's >>stdio. >Yep. That's what happens when you use the hack vfork(). Sean, I'm disapointed in you. % cat > test.c #include main() { printf("hello "); switch(fork()) { case 0: printf("world\n"); exit(0); case -1: perror("fork"); exit(1); default: exit(0); } } % cc test.c -o test % ./test hello % hello world ./test hello world hello % That's the way that stdio works.