Index: fusl/src/stdio/fclose.c |
diff --git a/fusl/src/stdio/fclose.c b/fusl/src/stdio/fclose.c |
index d687a8779b64f2d46b8790165c695b9612d3cc0a..802982defe62380cb888fb1102c0b80926f32cdc 100644 |
--- a/fusl/src/stdio/fclose.c |
+++ b/fusl/src/stdio/fclose.c |
@@ -1,32 +1,37 @@ |
#include "stdio_impl.h" |
#include "libc.h" |
-static void dummy(FILE *f) { } |
+static void dummy(FILE* f) {} |
weak_alias(dummy, __unlist_locked_file); |
-int fclose(FILE *f) |
-{ |
- int r; |
- int perm; |
- |
- FLOCK(f); |
+int fclose(FILE* f) { |
+ int r; |
+ int perm; |
- __unlist_locked_file(f); |
+ FLOCK(f); |
- if (!(perm = f->flags & F_PERM)) { |
- FILE **head = __ofl_lock(); |
- if (f->prev) f->prev->next = f->next; |
- if (f->next) f->next->prev = f->prev; |
- if (*head == f) *head = f->next; |
- __ofl_unlock(); |
- } |
+ __unlist_locked_file(f); |
- r = fflush(f); |
- r |= f->close(f); |
+ if (!(perm = f->flags & F_PERM)) { |
+ FILE** head = __ofl_lock(); |
+ if (f->prev) |
+ f->prev->next = f->next; |
+ if (f->next) |
+ f->next->prev = f->prev; |
+ if (*head == f) |
+ *head = f->next; |
+ __ofl_unlock(); |
+ } |
- if (f->getln_buf) free(f->getln_buf); |
- if (!perm) free(f); |
- else FUNLOCK(f); |
+ r = fflush(f); |
+ r |= f->close(f); |
- return r; |
+ if (f->getln_buf) |
+ free(f->getln_buf); |
+ if (!perm) |
+ free(f); |
+ else |
+ FUNLOCK(f); |
+ |
+ return r; |
} |