author | Rich Felker <dalias@aerifal.cx> | 2015年06月16日 07:11:19 +0000 |
---|---|---|
committer | Rich Felker <dalias@aerifal.cx> | 2015年06月16日 07:11:19 +0000 |
commit | 1b0cdc8700d29ef018bf226d74b2b58b23bce91c (patch) | |
tree | 53c58824a9d73de47296b5a8885aefc9a1f39d0b /src/stdio/fclose.c | |
parent | f22a9edaf8a6f2ca1d314d18b3785558279a5c03 (diff) | |
download | musl-1b0cdc8700d29ef018bf226d74b2b58b23bce91c.tar.gz |
-rw-r--r-- | src/stdio/fclose.c | 6 |
diff --git a/src/stdio/fclose.c b/src/stdio/fclose.c index 317b3c90..839d88af 100644 --- a/src/stdio/fclose.c +++ b/src/stdio/fclose.c @@ -14,11 +14,11 @@ int fclose(FILE *f) __unlist_locked_file(f); if (!(perm = f->flags & F_PERM)) { - OFLLOCK(); + FILE **head = __ofl_lock(); if (f->prev) f->prev->next = f->next; if (f->next) f->next->prev = f->prev; - if (libc.ofl_head == f) libc.ofl_head = f->next; - OFLUNLOCK(); + if (*head == f) *head = f->next; + __ofl_unlock(); } r = fflush(f); |