aboutsummaryrefslogtreecommitdiffstats
path: root/usr/klibc/stdio/fclose.c
blob: e4b5c6aeb150c314564d9366e4a4d3ead0771281 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
/*
 * fclose.c
 */

#include "stdioint.h"

int fclose(FILE *file)
{
	struct _IO_file_pvt *f = stdio_pvt(file);
	int rv;

	fflush(file);

	rv = f->funcs.close(f->cookie);

	/* Remove from linked list */
	f->next->prev = f->prev;
	f->prev->next = f->next;

	free(f);
	return rv;
}