X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=src%2Fstdio%2Ffclose.c;h=317b3c901e7dfd066bfcb3a236b89c2a8b8e02cd;hb=c63c98a6067030a25a42703db1209ccbcc74803a;hp=8fdc3f7d2b667d125e4aa7bc115d53f68e852331;hpb=617182734ca0beffa347747019d78b972e2038f9;p=musl diff --git a/src/stdio/fclose.c b/src/stdio/fclose.c index 8fdc3f7d..317b3c90 100644 --- a/src/stdio/fclose.c +++ b/src/stdio/fclose.c @@ -1,11 +1,19 @@ #include "stdio_impl.h" +#include "libc.h" + +static void dummy(FILE *f) { } +weak_alias(dummy, __unlist_locked_file); int fclose(FILE *f) { int r; - int perm = f->flags & F_PERM; + int perm; + + FFINALLOCK(f); + + __unlist_locked_file(f); - if (!perm) { + if (!(perm = f->flags & F_PERM)) { OFLLOCK(); if (f->prev) f->prev->next = f->next; if (f->next) f->next->prev = f->prev;