develooper Front page | perl.perl5.porters | Postings from May 2004

Re: [perl #29883] Closing file seems to cause a seek operation

Alan Burlison
May 28, 2004 16:11
Re: [perl #29883] Closing file seems to cause a seek operation
Message ID:
Nicholas Clark wrote:

>>>I had this hunch that it's because you're using exit() (rather than 
>>>and I'd guess that exit is calling fflush(), and that you're hitting the
>>>bug in Solaris that fflush() clobbers input streams.
>>That particular bug was fixed in Solaris 8, AFAIK, this is something 

Actually, it appears it wasn't fixed until Solaris 9.

> As this behaviour is replicatable in Solaris 10, it has to be something
> different.

It is, it exactly your hunch - you shouldn't use exit() in a child 
process that doesn't exec, you should use _exit.

>>>(ie something non-conformant with C89. Yes. C EIGHTY nine. Not C99.
>>>Everyone expecting universal C99 conformance any time soon will be
>>The behaviour exhibited is required by SVID.  It's doing what it is 
>>supposed to
> I was meaning the fflush(NULL) behaviour, which seems not to be the cause
> here, w.r.t. the C89 comment.
> And I wasn't clear - it wasn't a dig at Solaris in particular. It's more
> a general frustration that the world sucks, and takes {sometime,maybe,never}
> to achieve conformance with standards.

This area of behaviour is very poorly defined, and even appears to 
conflict in the various standards - there was an immense amount of 
legwork expended on trying to decide which behaviour was correct, and 
what happens now doesn't conflict with any of the relevant standards.

Alan Burlison
-- Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About