Fix freopen so it resets stream buffer (#61)
This commit is contained in:
@ -46,6 +46,8 @@ FILE *freopen(const char *pathname, const char *mode, FILE *stream) {
|
||||
dup3(fd, stream->fd, flags & O_CLOEXEC);
|
||||
close(fd);
|
||||
stream->iomode = flags;
|
||||
stream->beg = 0;
|
||||
stream->end = 0;
|
||||
return stream;
|
||||
} else {
|
||||
return NULL;
|
||||
|
||||
Reference in New Issue
Block a user