Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!utgpu!water!watmath!clyde!rutgers!mit-eddie!uw-beaver!tektronix!cae780!leadsv!eps2!jon From: jon@eps2.UUCP Newsgroups: comp.unix.questions Subject: Re: A couple questions Message-ID: <80@eps2.UUCP> Date: Wed, 15-Apr-87 02:21:00 EST Article-I.D.: eps2.80 Posted: Wed Apr 15 02:21:00 1987 Date-Received: Fri, 17-Apr-87 00:15:37 EST References: <3164@jade.BERKELEY.EDU> <1296@decuac.DEC.COM> Organization: Scumtronics Inc. Lines: 17 Summary: _exit(), not exit() In article <1296@decuac.DEC.COM>, avolio@gildor.dec.com (Frederick M. Avolio) writes: > if ((pid = fork()) == 0) /* IF CHILD */ > { > execl("/bin/sh", "sh", "-c", arg, 0); > printf("HELP! SOMEONE STOLE THE SHELL!\n"); > exit(1); Use _exit() in this instance instead of exit() because there is the possibility of flushing the stdio buffers twice, once in the child and once in the parent, which wouldn't really be right. You might see some output twice. I would probably use an fputs to stderr here, to avoid buffering. This was probably just an oversight on Frederick's followup. To really confuse people running ps, replace "sh" with a clever saying in double quotes. Jonathan Hue DuPont Design Technologies/Via Visuals leadsv!eps2!jon