Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com Date: Thu, 9 Dec 2004 19:49:18 -0500 (EST) From: Igor Pechtchanski Reply-To: cygwin AT cygwin DOT com To: Peter Astrand cc: cygwin AT cygwin DOT com Subject: Re: short fread(), but no ferror/feof In-Reply-To: Message-ID: References: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII On Fri, 10 Dec 2004, Peter Astrand wrote: > >> 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 > > >A simple, compilable test case with results shown on both linux and > >cygwin would prove your theory. > > Here you go; example follows. Test run on Linux: > > --- > Got 66 bytes: > /bin/ls: /somebogus: Filen eller katalogen finns inte > /etc/passwd > |EOF has been reached. > --- > > Test run on Cygwin: > > --- > $ ./a.exe > Got 9 bytes: > /bin/ls: | > --- > > As you can see, the result is partial, and there is no EOF nor error. > > I guess this is the problem described at > http://sources.redhat.com/ml/newlib/2004/msg00477.html. Perhaps you can > apply the suggested patch? According to , the patch was checked in on Oct 26. Cygwin uses the latest version of newlib. Cygwin 1.5.12-1 was released on Nov 10, so it should contain this patch. You can verify this by downloading the Cygwin source package, and looking at newlib/libc/stdio/fread.c. Igor -- http://cs.nyu.edu/~pechtcha/ |\ _,,,---,,_ pechtcha AT cs DOT nyu DOT edu ZZZzz /,`.-'`' -. ;-;;,_ igor AT watson DOT ibm DOT com |,4- ) )-,_. ,\ ( `'-' Igor Pechtchanski, Ph.D. '---''(_/--' `-'\_) fL a.k.a JaguaR-R-R-r-r-r-.-.-. Meow! "The Sun will pass between the Earth and the Moon tonight for a total Lunar eclipse..." -- WCBS Radio Newsbrief, Oct 27 2004, 12:01 pm EDT -- 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/