[Gdal-dev] Problem of creation with Gtiff driver on Solaris

Frank Warmerdam fwarmerdam at gmail.com
Mon Sep 12 09:47:33 EDT 2005


On 9/12/05, Frédéric Trastour <support at geoimage.fr> wrote:
> Hello Franck,
> 
> >>
> >>Try the patch (adding TIFFSeekFile(tif,0,SEEK_SET) before the
> >>WriteOK call and see if that helps.
> >>
> 
> Thanks a lot, this solves the problem.
> 
> It's really strange anyway and It's not very reassuring to see that simple file
> access may be broken on Solaris. There are probably tons of similar code
> in other drivers...

Frédéric,

Ed Grissom informed me that:

>Not sure if this has *any* bearing at all, but the doc for "fopen" for some
>STD_C_LIBs says that if you open a file for modify ("+"), then you must
>fseek (or fflush?)  between any freads and fwrites.  I believe that for some
>systems, this is not strictly necessary, but for others it is.

Thus, it may be that the Solaris stdio isn't broken, it just chooses to make
things difficult while staying within the specification.  I don't know how many
other parts of the library may be affected but this is the one that has bitten
us in the past.  

I think the seek was removed in the past because it made it difficult for
someone to implement stream oriented access to TIFF files though I am not
very sure about that aspect.  In any event, I think I had better re-introduce
the seek in the core code till we work out more details. 

Best regards,
-- 
---------------------------------------+--------------------------------------
I set the clouds in motion - turn up   | Frank Warmerdam, warmerdam at pobox.com
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush    | Geospatial Programmer for Rent




More information about the Gdal-dev mailing list