commit 0b80a7b040 added the ability to
set application-provided stdio FILE buffers, adding the possibility
that stderr might be buffered at exit time, but __stdio_exit did not
have code to flush it.
this regression was not present in any release.
26 lines
578 B
C
26 lines
578 B
C
#include "stdio_impl.h"
|
|
|
|
static FILE *volatile dummy_file = 0;
|
|
weak_alias(dummy_file, __stdin_used);
|
|
weak_alias(dummy_file, __stdout_used);
|
|
weak_alias(dummy_file, __stderr_used);
|
|
|
|
static void close_file(FILE *f)
|
|
{
|
|
if (!f) return;
|
|
FFINALLOCK(f);
|
|
if (f->wpos > f->wbase) f->write(f, 0, 0);
|
|
if (f->rpos < f->rend) f->seek(f, f->rpos-f->rend, SEEK_CUR);
|
|
}
|
|
|
|
void __stdio_exit(void)
|
|
{
|
|
FILE *f;
|
|
for (f=*__ofl_lock(); f; f=f->next) close_file(f);
|
|
close_file(__stdin_used);
|
|
close_file(__stdout_used);
|
|
close_file(__stderr_used);
|
|
}
|
|
|
|
weak_alias(__stdio_exit, __stdio_exit_needed);
|