www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/2001/09/23/14:36:59

From: "Tim Van Holder" <tim DOT van DOT holder AT pandora DOT be>
To: <djgpp-workers AT delorie DOT com>
Cc: "Eli Zaretskii" <eliz AT is DOT elta DOT co DOT il>
Subject: Re: The Perl/FD issue: update
Date: Sun, 23 Sep 2001 20:35:42 +0200
Message-ID: <000601c1445e$8d466520$047d76d5@pandora.be>
MIME-Version: 1.0
X-Priority: 3 (Normal)
X-MSMail-Priority: Normal
X-Mailer: Microsoft Outlook, Build 10.0.2627
Importance: Normal
X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4807.1700
In-reply-to: <2950-Sun23Sep2001185940+0300-eliz@is.elta.co.il>
Reply-To: djgpp-workers AT delorie DOT com
Errors-To: nobody AT delorie DOT com
X-Mailing-List: djgpp-workers AT delorie DOT com
X-Unsubscribes-To: listserv AT delorie DOT com

This is the output from autoconf's testsuite (test 4)
M4 gets run twice; the "'debug' FILE*" lines come from m4, right
before main()'s call to exit(); the others come from the
fcloseall helper.

+'debug' FILE* current state:
+  _cnt            = 15075
+  _ptr            = 137b2d
+  _base           = 137610
+  _bufsiz         = 16384
+  _flag           = 48
+  _file           = 3
+  _name_to_remove = (null)
+  _fillsize       = 0
>> seems normal
+Auto-closing file:
+  _cnt            = 0
+  _ptr            = 0
+  _base           = 0
+  _bufsiz         = 0
+  _flag           = 12
+  _file           = 0
+  _name_to_remove = (null)
+  _fillsize       = 0
+* fflush(f) returns 0
>> stdin; OK
+Auto-closing file:
+  _cnt            = 0
+  _ptr            = 0
+  _base           = 0
+  _bufsiz         = 0
+  _flag           = 17
+  _file           = 1
+  _name_to_remove = (null)
+  _fillsize       = 0
+* fflush(f) returns 0
>> stdout; OK
+Auto-closing file:
+  _cnt            = 0
+  _ptr            = c1248
+  _base           = 0
+  _bufsiz         = 0
+  _flag           = 18
+  _file           = 2
+  _name_to_remove = (null)
+  _fillsize       = 0
+* fflush(f) returns 0
>> stderr; OK
+Auto-closing file:
+  _cnt            = 0
+  _ptr            = 0
+  _base           = 0
+  _bufsiz         = 0
+  _flag           = 18
+  _file           = 4
+  _name_to_remove = (null)
+  _fillsize       = 0
+* fflush(f) returns 0
+* fclose(f) returns -1
>> stdaux/stdprn - was closed by Perl, so close fails
+Auto-closing file:
+  _cnt            = 0
+  _ptr            = 0
+  _base           = 0
+  _bufsiz         = 0
+  _flag           = 514
+  _file           = 3
+  _name_to_remove = (null)
+  _fillsize       = 0
+* fflush(f) returns 0
+* fclose(f) returns 0
>> FD 3, but not our file
+Auto-closing file:
+  _cnt            = 15075
+  _ptr            = 137b2d
+  _base           = 137610
+  _bufsiz         = 16384
+  _flag           = 48
+  _file           = 3
+  _name_to_remove = (null)
+  _fillsize       = 0
+* fflush(f) returns -1
+* fclose(f) returns -1
>> Aha - BINGO - this is actually our file.

So the problem seems to be that FD 3 gets closed using the
WRONG FILE structure (stdaux?) -> the close works, but does
no flushing.  Then the fflush and close fail because the FD
is closed.
So I guess we need skip stdaux and stdprn in fcloseall, if
those FD's were closed at startup?

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019