give libc access to its own malloc even if public malloc is interposed
[musl] / src / stdio / __stdio_exit.c
index 5741070..a5e42c6 100644 (file)
@@ -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)