mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-05-22 21:32:31 +00:00
Fix freopen so it resets stream buffer (#61)
This commit is contained in:
parent
7583b3accc
commit
aad841610e
2 changed files with 68 additions and 0 deletions
|
@ -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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue