summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJari Vetoniemi <mailroxas@gmail.com>2018-11-20 10:43:16 +0200
committerJari Vetoniemi <mailroxas@gmail.com>2018-11-20 10:43:16 +0200
commitb0c07582f4972a04132e762b5f462d94b32fbd69 (patch)
treec6b73867f62248d8de7d3ffd2706c07195d0bafa
parent3f0a3b55ddcc44a5708d8b7bc18dc8bfa4a1adcc (diff)
libc-stdio: fix standard streams with libstdc++
-rw-r--r--src/libc-stdio.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/libc-stdio.c b/src/libc-stdio.c
index 34fe40d..0d19f20 100644
--- a/src/libc-stdio.c
+++ b/src/libc-stdio.c
@@ -28,12 +28,27 @@ bionic_file_to_glibc_file(FILE *f)
return f;
}
+// libstdc++ uses these directly for standard streams, thus we need to wrap em
+// and IO_file wraps aren't enough.
+
int
bionic_fflush(FILE *f)
{
return fflush(bionic_file_to_glibc_file(f));
}
+size_t
+bionic_fwrite(const void *ptr, size_t size, size_t nmemb, FILE *stream)
+{
+ return fwrite(ptr, size, nmemb, bionic_file_to_glibc_file(stream));
+}
+
+int
+bionic_putc(int ch, FILE *f)
+{
+ return putc(ch, bionic_file_to_glibc_file(f));
+}
+
// Wrapping internal glibc VTABLE functions to handle bionic's pre-M crap
// We define __real_IO_file_xsputn in libc.c so linker will link our library,
// it's not used however for anything.