This is the mail archive of the cygwin mailing list for the Cygwin project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

fseek064 calling fflush on Cygwin

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

(gdb) l 110
105              to make the change simpler, more contained, and less
106              to miss a code scenario.  */
107           if ((fp->_r > 0 || fp->_ur > 0) && (seekfn = fp->_seek) !=
108             {
109               _fpos_t curoff;
111               /* Get the physical position we are at in the file.  */
112               if (fp->_flags & __SOFF)
113                 curoff = fp->_offset;
114               else
115                 {
116                   /* We don't know current physical offset, so ask for
it.  */
117                   curoff = (*seekfn) (fp->_cookie, (_fpos_t) 0, SEEK_CUR);
118                   if (curoff == -1L)
119                     {
120                       _funlockfile (fp);
121                       return 0;
122                     }
123                 }
124               if (fp->_flags & __SRD)

(gdb) p/x fp->_offset
$12 = 0x65f468000
(gdb) ptype fp->_offset
type = long long int

(gdb) p/x curoff
$13 = 0x5f468000
(gdb) ptype curoff
type = long int

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?

Brian Ford
Lead Realtime Software Engineer
VITAL - Visual Simulation Systems
FlightSafety International
the best safety device in any aircraft is a well-trained crew...

Unsubscribe info:
Problem reports:

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]