X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;ds=sidebyside;f=src%2Fstdio%2F__stdio_exit.c;h=a5e42c675fa90c4edc2ebde2576aaa543ed91a14;hb=59b64ff686cef2a87e9552658b2c8d2531f87176;hp=191b4454a48d3ff4258c2cd6dd5d29738d79620e;hpb=1b0cdc8700d29ef018bf226d74b2b58b23bce91c;p=musl diff --git a/src/stdio/__stdio_exit.c b/src/stdio/__stdio_exit.c index 191b4454..a5e42c67 100644 --- a/src/stdio/__stdio_exit.c +++ b/src/stdio/__stdio_exit.c @@ -9,8 +9,8 @@ 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); + 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) @@ -19,6 +19,7 @@ void __stdio_exit(void) 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);