www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/2001/09/23/11:21: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: The Perl/FD issue: update
Date: Sun, 23 Sep 2001 17:20:36 +0200
Message-ID: <000001c14443$4e3861a0$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
Reply-To: djgpp-workers AT delorie DOT com

Since debugging doesn't help (gdb uses the FD's that cause trouble),
and I'd been unable so far to create a minimal program that shows
the problem, I tried instrumenting m4 with lots of fprintf(stderr,...).

Annoyingly, everything seemed normal: setting up the FILE* for
debug output worked, and fprintf's to that FILE* seemed to return
normal values.
Then, on a hunch, I added

  fflush (debug);

to M4's main().  Lo and behold, it started working.
The same effect was reached by using

  fclose (debug);

So it would seem that the problem is that files attached to FD's
3 and 4 do not get closed at the end of the program, resulting in
empty or incomplete files.
Still, according to stdiohk.c, all files with fileno > 2 get
fclose()d by __stdio_cleanup_proc(), and an fprintf() in the
close helper does show it being called for FDs 0, 2, 4 and 3.

- Raw text -


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