diff options
Diffstat (limited to 'system/lib/libc/musl/src/stdio')
-rw-r--r-- | system/lib/libc/musl/src/stdio/__toread.c | 10 | ||||
-rw-r--r-- | system/lib/libc/musl/src/stdio/__towrite.c | 18 |
2 files changed, 18 insertions, 10 deletions
diff --git a/system/lib/libc/musl/src/stdio/__toread.c b/system/lib/libc/musl/src/stdio/__toread.c index 2e804f64..f00cc467 100644 --- a/system/lib/libc/musl/src/stdio/__toread.c +++ b/system/lib/libc/musl/src/stdio/__toread.c @@ -12,13 +12,3 @@ int __toread(FILE *f) f->rpos = f->rend = f->buf; return 0; } - -static const int dummy = 0; -weak_alias(dummy, __towrite_used); - -void __stdio_exit(void); - -void __seek_on_exit() -{ - if (!__towrite_used) __stdio_exit(); -} diff --git a/system/lib/libc/musl/src/stdio/__towrite.c b/system/lib/libc/musl/src/stdio/__towrite.c new file mode 100644 index 00000000..3698d8b7 --- /dev/null +++ b/system/lib/libc/musl/src/stdio/__towrite.c @@ -0,0 +1,18 @@ +#include "stdio_impl.h" + +int __towrite(FILE *f) +{ + f->mode |= f->mode-1; + if (f->flags & (F_NOWR)) { + f->flags |= F_ERR; + return EOF; + } + /* Clear read buffer (easier than summoning nasal demons) */ + f->rpos = f->rend = 0; + + /* Activate write through the buffer. */ + f->wpos = f->wbase = f->buf; + f->wend = f->buf + f->buf_size; + + return 0; +} |