From owner-freebsd-hackers Wed Jul 28 11:14:49 1999 Delivered-To: freebsd-hackers@freebsd.org Received: from m2-2-dbn.dial-up.net (m2-2-dbn.dial-up.net [196.34.155.66]) by hub.freebsd.org (Postfix) with ESMTP id 6B5B914FD7 for ; Wed, 28 Jul 1999 11:14:40 -0700 (PDT) (envelope-from rnordier@nordier.com) Received: (from rnordier@localhost) by m2-2-dbn.dial-up.net (8.8.7/8.6.12) id UAA17849; Wed, 28 Jul 1999 20:13:20 +0200 (SAST) From: Robert Nordier Message-Id: <199907281813.UAA17849@m2-2-dbn.dial-up.net> Subject: Re: bin/12852: Non-standard behavior of fread(3) In-Reply-To: <38333.933180786@axl.noc.iafrica.com> from Sheldon Hearn at "Jul 28, 1999 06:53:06 pm" To: sheldonh@uunet.co.za (Sheldon Hearn) Date: Wed, 28 Jul 1999 20:13:18 +0200 (SAST) Cc: hackers@FreeBSD.ORG X-Mailer: ELM [version 2.4ME+ PL54 (25)] MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG 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