diff options
author | Jari Vetoniemi <mailroxas@gmail.com> | 2018-11-20 10:43:16 +0200 |
---|---|---|
committer | Jari Vetoniemi <mailroxas@gmail.com> | 2018-11-20 10:43:16 +0200 |
commit | b0c07582f4972a04132e762b5f462d94b32fbd69 (patch) | |
tree | c6b73867f62248d8de7d3ffd2706c07195d0bafa /src | |
parent | 3f0a3b55ddcc44a5708d8b7bc18dc8bfa4a1adcc (diff) |
libc-stdio: fix standard streams with libstdc++
Diffstat (limited to 'src')
-rw-r--r-- | src/libc-stdio.c | 15 |
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. |