X-Git-Url: https://git.gag.com/?a=blobdiff_plain;f=functions%2Fstdio%2Ffreopen.c;h=e8cc72a1f2924cba8e56c8acc5947ff2525ed7bf;hb=ff49b562378947e09d07ea19206bbae73cd12fab;hp=13992deb8214f5fe9f7e7d76584da4a5b1247dc3;hpb=420908538bd49126b447dd6059af363195c41e1e;p=fw%2Fpdclib diff --git a/functions/stdio/freopen.c b/functions/stdio/freopen.c index 13992de..e8cc72a 100644 --- a/functions/stdio/freopen.c +++ b/functions/stdio/freopen.c @@ -27,7 +27,7 @@ struct _PDCLIB_file_t * freopen( const char * _PDCLIB_restrict filename, const c /* FIXME: If filename is NULL, change mode. */ /* TODO: This function can change wide orientation of a stream */ if ( filename == NULL ) return NULL; - if ( stream->status & _PDCLIB_WROTELAST ) fflush( stream ); + if ( stream->status & _PDCLIB_FWRITE ) fflush( stream ); if ( stream->status & _PDCLIB_LIBBUFFER ) free( stream->buffer ); _PDCLIB_close( stream->handle ); clearerr( stream ); @@ -37,7 +37,7 @@ struct _PDCLIB_file_t * freopen( const char * _PDCLIB_restrict filename, const c if ( ( stream->buffer = malloc( BUFSIZ ) ) == NULL ) return NULL; stream->bufsize = BUFSIZ; stream->bufidx = 0; - stream->status |= ( _PDCLIB_LIBBUFFER | _PDCLIB_VIRGINSTR ); + stream->status |= _PDCLIB_LIBBUFFER; /* TODO: Setting mbstate */ return stream; }