Mail Archives: djgpp-workers/2001/09/23/11:21:59
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 -