1 /* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */
3 #include <msvcrt/stdio.h>
5 #include <msvcrt/sys/types.h>
6 #include <msvcrt/sys/stat.h>
7 #include <msvcrt/stdlib.h>
8 #include <msvcrt/errno.h>
9 #include <msvcrt/internal/file.h>
11 // changed check for writable stream
26 // flush only if stream was opened for writing
27 if ( !(f
->_flag
&_IOSTRG
) ) {
28 if ( OPEN4WRITING(f
) )
31 if (_close(fileno(f
)) < 0)
33 if (f
->_flag
&_IOMYBUF
)
36 // Kernel might do this later
37 if (f
->_flag
& _IORMONCL
&& f
->_name_to_remove
)
39 remove(f
->_name_to_remove
);
40 free(f
->_name_to_remove
);
41 f
->_name_to_remove
= 0;