Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 28 Jul 1999 20:13:18 +0200 (SAST)
From:      Robert Nordier <rnordier@nordier.com>
To:        sheldonh@uunet.co.za (Sheldon Hearn)
Cc:        hackers@FreeBSD.ORG
Subject:   Re: bin/12852: Non-standard behavior of fread(3)
Message-ID:  <199907281813.UAA17849@m2-2-dbn.dial-up.net>
In-Reply-To: <38333.933180786@axl.noc.iafrica.com> from Sheldon Hearn at "Jul 28, 1999 06:53:06 pm"

next in thread | previous in thread | raw e-mail | index | archive | help
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 majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199907281813.UAA17849>