1.5.0: Problem with fseeko() after fdopen()

David Rothenberger daveroth@acm.org
Thu Jul 24 17:34:00 GMT 2003


I'm running 1.5.0 with all the latest test packages installed.

I recently noticed a problem with the test release of patch and its
ability to read from stdin.  I started to investigate and have
extracted the problematic code from patch into a test program.

The program (and patch) use open() to create/open a file and then
use fdopen() on the resulting file descriptor.  The file is opened
in RW mode, some data is written to it, the file is flushed, and
then an attempt is made to seek to the beginning of the file.

This last seek fails.  The seek is done using fseeko().  If fseek()
is used instead, all is fine.

I did a bit of debugging in newlib and determined that fdopen()
doesn't set pfp->_seek64, which causes the problem.  If I use
fopen() to create the file, then pfp->_seek64 is set (since fopen()
ends up calling fopen64()).

I must admit at this point to complete ignorance about how the large
file support actually works and how fseeko() magically get resolved
to fseeko64().

Is fdopen() still supported in 1.5.0?  Am I doing something else
wrong?  I have cygwin1.dll built from CVS with debugging symbols and
some curiousity, so if anyone has suggestions on how to proceed
debugging, I'd be happy to listen.

My test program to demonstrate the problem (all copied from patch
sources) and cygcheck output are attached.

Dave

-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: tst.c
URL: <http://cygwin.com/pipermail/cygwin/attachments/20030724/17b011ec/attachment.c>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: cygcheck.out
URL: <http://cygwin.com/pipermail/cygwin/attachments/20030724/17b011ec/attachment.ksh>
-------------- next part --------------
--
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/


More information about the Cygwin mailing list