projects
/
oweals
/
musl.git
/ blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
history
|
raw
|
HEAD
yet another ugly legacy syscall rename...
[oweals/musl.git]
/
src
/
stdio
/
fclose.c
1
#include "stdio_impl.h"
2
3
int fclose(FILE *f)
4
{
5
int r;
6
int perm = f->flags & F_PERM;
7
8
if (!perm) {
9
OFLLOCK();
10
if (f->prev) f->prev->next = f->next;
11
if (f->next) f->next->prev = f->prev;
12
if (ofl_head == f) ofl_head = f->next;
13
OFLUNLOCK();
14
}
15
16
r = fflush(f) | f->close(f);
17
18
if (!perm) free(f);
19
20
return r;
21
}