X-Git-Url: http://nsz.repo.hu/git/?p=musl;a=blobdiff_plain;f=src%2Fstdio%2Ffclose.c;h=92bf7ff8858dd214bca90c3961df31062cfd5a23;hp=8fdc3f7d2b667d125e4aa7bc115d53f68e852331;hb=c8cb6bcdf009e94c12c6e256b8e24a9bc5fdaf05;hpb=892cafff665b44d238e3b664f61ca38dd965cba6 diff --git a/src/stdio/fclose.c b/src/stdio/fclose.c index 8fdc3f7d..92bf7ff8 100644 --- a/src/stdio/fclose.c +++ b/src/stdio/fclose.c @@ -3,9 +3,12 @@ int fclose(FILE *f) { int r; - int perm = f->flags & F_PERM; + int perm; + + /* This lock is not paired with any unlock. */ + FLOCK(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;