Sheldon Hearn wrote:
 
> Could someone have a look at the patch proposed on PR 12852? I
> understand the motivation, since it seems reasonable to me that ferror()
> should return EBADF after an attempt to read from stdout. At the moment,
> ferror() returns 0 after an attempt to read from stdout.
 
There's no question this needs changing.  An ISO example actually
reads along the lines of:

    while (!feof(fp) && !ferror(fp))
        fscanf(fp, ...);

with no further provision for error-detection.  Applied to stdout,
this never terminates.

The SVID wording is more definite than ISO in discussing this ("less
than nitems only if a read error or end-of-file is encountered"),
but mostly the present behavior just conflicts with sense and
practice.

-- 
Robert Nordier


To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-hackers" in the body of the message

Reply via email to