[PATCH 1/1] stdio: fix named pipe issue
Rich Felker
dalias at aerifal.cx
Thu Jun 16 22:39:27 UTC 2011
On Thu, Jun 16, 2011 at 11:54:45AM -0700, Jian Peng wrote:
> This is follow-up of my investigation and proposed
> fix at
> http://old.nabble.com/named-pipe-is-borken-and-proposed-fix-td31753483.html#a31753483
>
> The testing programs worked well with glibc, but failed in uClibc-0.9.32.
>
> As Laurent pointed out, this is undefined in standard. For the sake of
> application developers who want to port apps from glibc to uClibc without
> worrying about the subtle difference, it is nice to help them out with
> following patch.
>
> The problem is that FIFO is a special file type, and the conventional EOF
> is useless, and should not be set.
>
> The fix is to avoid setting __FLAG_EOF for stream associated with FIFO file
> after all senders were closed.
This patch adds bloat and as far as I can tell it's wrong. The
standard (C) says that the EOF indicator is set when EOF is reached,
that it is not cleared until you call clearerr or fseek/rewind, and
that fgetc returns EOF if the EOF indicator is set. If glibc does not
behave this way for fifos, that's a glibc bug.
Rich
More information about the uClibc
mailing list