From: "Tim Van Holder" To: Cc: "Eli Zaretskii" 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 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit 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.