aboutsummaryrefslogtreecommitdiff
path: root/system/lib/libc
diff options
context:
space:
mode:
authorBruce Mitchener <bruce.mitchener@gmail.com>2014-01-14 09:44:15 +0700
committerBruce Mitchener <bruce.mitchener@gmail.com>2014-01-14 15:05:20 +0700
commita15486ffea916f46cca822d7614a44e48393b8d7 (patch)
treef47b7437e5a3f81f9a13ef1b5be45e5e5c59cf8e /system/lib/libc
parentea5facf1ab2c769e07b4046c6ed7257c2a8caf5c (diff)
Fix asm2 compilation where __toread was used.
Diffstat (limited to 'system/lib/libc')
-rw-r--r--system/lib/libc/musl/readme.txt2
-rw-r--r--system/lib/libc/musl/src/stdio/__toread.c10
-rw-r--r--system/lib/libc/musl/src/stdio/__towrite.c18
3 files changed, 19 insertions, 11 deletions
diff --git a/system/lib/libc/musl/readme.txt b/system/lib/libc/musl/readme.txt
index 7ad89449..02f3396a 100644
--- a/system/lib/libc/musl/readme.txt
+++ b/system/lib/libc/musl/readme.txt
@@ -10,4 +10,4 @@ Differences from upstream musl include:
* Disable FLOCK, FUNLOCK and FFINALLOCK
* Simplify fputwc to not rely on musl stream internals
* signgam is no longer a weak alias of __signgam.
-
+* __toread and __towrite have had shutdown functionality removed.
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;
+}