Restored work-around for hangs when trying to use disk-based handlers
[tangerine.git] / compiler / clib / fclose.c
blob5d56e638b982bd5fded1b4f93ac0056d5b7f1c28
1 /*
2 Copyright © 1995-2007, The AROS Development Team. All rights reserved.
3 $Id$
5 ANSI C function fclose().
6 */
8 #include <proto/exec.h>
9 #include <proto/dos.h>
10 #include <stdlib.h>
11 #include <unistd.h>
12 #include <errno.h>
13 #include "__errno.h"
14 #include "__stdio.h"
17 /*****************************************************************************
19 NAME */
20 #include <stdio.h>
22 int fclose (
24 /* SYNOPSIS */
25 FILE * stream)
27 /* FUNCTION
28 Closes a stream.
30 INPUTS
31 stream - Stream to close.
33 RESULT
34 Upon successful completion 0 is returned. Otherwise, EOF is
35 returned and the global variable errno is set to indicate the
36 error. In either case no further access to the stream is possible.
38 NOTES
39 This function must not be used in a shared library or
40 in a threaded application.
42 EXAMPLE
44 BUGS
46 SEE ALSO
47 fopen(), open(), close()
49 INTERNALS
51 ******************************************************************************/
53 FILENODE * fn;
55 if (close(stream->fd) == -1)
56 return EOF;
58 fn = FILE2FILENODE (stream);
59 Remove ((struct Node *)fn);
61 free(fn);
63 return 0;
64 } /* fclose */