Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.1 6/24/83; site gargoyle.UChicago.UUCP Path: utzoo!watmath!clyde!burl!ulysses!mhuxl!ihnp4!gargoyle!toby From: toby@gargoyle.UChicago.UUCP (Toby Harness) Newsgroups: net.unix-wizards Subject: Re: Why doesn't this work (fork and pipe problem) ??? Message-ID: <170@gargoyle.UChicago.UUCP> Date: Wed, 18-Jul-84 14:08:24 EDT Article-I.D.: gargoyle.170 Posted: Wed Jul 18 14:08:24 1984 Date-Received: Thu, 19-Jul-84 03:28:00 EDT References: <342@mddc.UUCP> Organization: U. Chicago - Computer Science Lines: 25 (sorry, but I can`t seem to reply) Well, you didn`t close the 'unused' sides of the pipe. pipe(pipefd); switch(pid=fork()) ... case 0: /* child */ ========> close(pipefd[0]); /* not necessary, just good practice */ close(1); dup(pipefd[1]); printf("about to exec who\n"); execlp("/bin/who", "who", (char*)0); printf("could not execute\n"); exit(0); default: /* parent */ ========> close (pipefd[1]); /* necessary */ close(0); dup(pipefd[0]); ... Toby Harness Ogburn/Stouffer Center, University of Chicago ...ihnp4!gargoyle!toby