[comp.unix.questions] Unix does work!

gandalf@csli.STANFORD.EDU (Juergen Wagner) (03/26/89)

The pipe consists of two ends, accessible through two file descriptors.
When the child process is forked, there are two processes with access to
the writable end. When the child exits, there is still the parent process
left which could write to the pipe. Therefore, a read will hang rather than
indicate EOF.

TFM says:
     Read calls on an empty pipe (no buffered data) with only one
     end  (all  write file descriptors closed) returns an end-of-
     file.

I suggest that you close the unused fds in the parent process, and your
program should work.

-- 
Juergen Wagner		   			gandalf@csli.stanford.edu
						 wagner@arisia.xerox.com