Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!ucbvax!decwrl!pyramid!prls!philabs!ttidca!retix!randy From: randy@retix.retix.COM (Miyazaki Randy) Newsgroups: comp.unix.questions Subject: Unix doesn't work ! Message-ID: <407@retix.retix.COM> Date: 24 Mar 89 02:14:24 GMT Reply-To: randy@retix.retix.com.UUCP (Miyazaki Randy) Distribution: usa Organization: Retix, Santa Monica CA Lines: 31 Why does the child read not terminate with a End of File indication ? Bizzarely enough, the program hangs both under BSD 4.3 and S5R3 (Interactive VP/IX 1.0.6). This seems to contradict any documentation on pipes I have seen. int pipefd[2]; char buf; main() { int len; if (pipe(pipefd) < 0) { perror("pipe"); exit(1); } if (fork()) { /* Parent process here */ printf("reading...\n"); len = read(pipefd[0], &buf, 1); printf("child read return %d\n", len); if (len < 0) perror("read"); exit(0); } sleep(2); printf("child process exiting, parent read should return EOF\n"); exit(0); }