Right. That explains it then. I couldn't see that documented anywhere but it makes sense.
Thanks everyone! On Jan 19, 2013 12:54 AM, "Nick Andrew" <n...@nick-andrew.net> wrote: > On Fri, Jan 18, 2013 at 05:57:09PM +1100, Chris Barnes wrote: > > What i mean is if the parent forked at the line > > pid = fork(); > > Then the child would begin executing at the next instruction. In this > case > > If(pid > 0){ exit(EXIT_SUCCESS); } > > Both parent and child resume/start executing at the next instruction, which > is the if() test. The child gets a return value of 0 from fork() whereas > the > parent gets a non-zero positive value. So in the parent, pid > 0 whereas > in the child, pid = 0. All other variables (all memory contents) are > identical between the parent and the child. > > Nick. > -- SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/ Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html