delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2004/12/05/11:18:16

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
X-Authentication-Warning: koeberg.lysator.liu.se: astrand owned process doing -bs
Date: Sun, 5 Dec 2004 17:17:46 +0100 (MET)
From: =?iso-8859-1?Q?Peter_=C5strand?= <astrand AT lysator DOT liu DOT se>
To: cygwin AT cygwin DOT com
Subject: short fread(), but no ferror/feof
Message-ID: <Pine.GSO.4.51L2.0412051701370.21199@koeberg.lysator.liu.se>
MIME-Version: 1.0
X-Spam-Checker-Version: SpamAssassin 2.63-lysator_fetto_1.2 (2004-01-11) on fetto.lysator.liu.se
X-Spam-Level:
X-Spam-Status: No, hits=-2.1 required=5.0 tests=AWL,J_CHICKENPOX_53 autolearn=no version=2.63-lysator_fetto_1.2
X-MIME-Autoconverted: from QUOTED-PRINTABLE to 8bit by delorie.com id iB5GIDin023360

I've discovered that fread(ptr, size, nitems, stream) sometimes returns a
value less than "nitems", but does not set feof() nor ferror(). As I
understand, this is incorrect: All fread() documentation I've found
confirms this. For example, IEEE Std 1003.1 says:

"Upon successful completion, fread() shall return the number of elements
successfully read which is less than nitems only if a read error or
end-of-file is encountered."

I've only noticed the problem when using fread() on a pipe, and when
setting a (another) file descriptor in the same application in
close-on-exec mode. The details are on http://python.org/sf/1071516. I've
been using the latest Cygwin (as of 2004-12-04) on Windows 98.

To me, this looks like a Cygwin bug. Any ideas?

/Peter Åstrand <astrand AT lysator DOT liu DOT se>


--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/


- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019