source: trunk/sys/dietlibc/fclose.c @ 254

Last change on this file since 254 was 1, checked in by alain, 8 years ago

First import

File size: 518 bytes
RevLine 
[1]1#include "dietstdio.h"
2#include <stdlib.h>
3#include <unistd.h>
4
5int fclose_unlocked(FILE *stream) {
6  int res;
7  FILE *f,*fl;
8  res=fflush_unlocked(stream);
9  res|= close(stream->fd);
10  for (fl=0,f=__stdio_root; f; fl=f,f=f->next)
11    if (f==stream) {
12      if (fl)
13        fl->next=f->next;
14      else
15        __stdio_root=f->next;
16      break;
17    }
18  if ((!(stream->flags&STATICBUF))&&(stream->buf))
19    free(stream->buf);
20  free(stream);
21  return res;
22}
23
24int fclose(FILE *stream) __attribute__((weak,alias("fclose_unlocked")));
Note: See TracBrowser for help on using the repository browser.