From b0c07582f4972a04132e762b5f462d94b32fbd69 Mon Sep 17 00:00:00 2001 From: Jari Vetoniemi Date: Tue, 20 Nov 2018 10:43:16 +0200 Subject: libc-stdio: fix standard streams with libstdc++ --- src/libc-stdio.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'src/libc-stdio.c') 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. -- cgit v1.2.3