read() blocks on pipes

Tim Waugh (
Mon, 24 Feb 1997 13:45:38 +0000 (GMT)

What exactly is supposed to happen when doing a read() on a pipe that has
been closed?

I have a routine to fork, redirect output to a pipe, and exec a child.
The parent reads from the pipe, and all is well until the child dies.
read() blocks -- is this correct behaviour? I'd like it to return with
some error or zero.