delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2007/06/22/17:44:59

X-Spam-Check-By: sourceware.org
To: cygwin AT cygwin DOT com
From: Eric Blake <ebb9 AT byu DOT net>
Subject: Re: fseek064 calling fflush on Cygwin
Date: Fri, 22 Jun 2007 20:26:35 +0000 (UTC)
Lines: 36
Message-ID: <loom.20070622T222112-683@post.gmane.org>
References: <Pine DOT CYG DOT 4 DOT 58 DOT 0706221436300 DOT 4312 AT PC1163-8460-XP DOT flightsafety DOT com>
Mime-Version: 1.0
User-Agent: Loom/3.14 (http://gmane.org/)
X-IsSubscribed: yes
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
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

Brian Ford <Brian.Ford <at> FlightSafety.com> writes:

> 
> I have an application that is having a 64-bit file I/O problem with Cygwin
> 1.7.0 CVS that it did not have with Cygwin 1.5.18.  I have tracked it
> down to the following series of calls in newlib:
> 
> #0  fflush (fp=0x7b5a764)
>     at ../../../../../cygwin/newlib/libc/stdio/fflush.c:124
> #1  0x611049ff in _fseeko64_r (ptr=0x16cbd008, fp=0x7b5a764,
>     offset=27368291304, whence=0)
>     at ../../../../../cygwin/newlib/libc/stdio64/fseeko64.c:326
> #2  0x61104edf in fseeko64 (fp=0x7b5a764, offset=27368291304, whence=0)
>     at ../../../../../cygwin/newlib/libc/stdio64/fseeko64.c:350

Thanks for the report.  Prior to a couple months ago, this wasn't a problem, 
because fseek(f,0,SEEK_END) was mistakenly succeeding on large files.  This is 
fallout from my recent patch to make fseek properly fail with EOVERFLOW; but as 
you discovered, a side effect is that fflush is no longer seeking to the end 
the way it should be when it ignores the EOVERFLOW.

> 
> So, it would seem that fflush is not 64 bit safe and fseeko64 should not
> be calling it, but I'm not sure how to fix it.
> 
> Any suggestions?
> 

In environments with large files, fflush needs to check for __SL64, in which 
case it should call fp->_seek64, not fp->_seek.  That clinches it - I need to 
complete my patch to make fflush reentrant and 64-bit safe.  I'll hopefully 
have something by early next week.

-- 
Eric Blake



--
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