mirror of
https://github.com/termux-pacman/termux-packages.git
synced 2025-12-26 13:40:22 +00:00
38 lines
747 B
Diff
38 lines
747 B
Diff
See https://github.com/termux/termux-packages/issues/11912.
|
|
|
|
--- a/lib/fflush.c
|
|
+++ b/lib/fflush.c
|
|
@@ -231,3 +231,32 @@
|
|
}
|
|
#endif
|
|
}
|
|
+
|
|
+#if defined __ANDROID__ && !defined __LP64__
|
|
+
|
|
+#include <dlfcn.h>
|
|
+
|
|
+typedef ssize_t (*write_impl_t)(int, const void *, size_t);
|
|
+
|
|
+ssize_t
|
|
+write(int __fd, const void *__buf, size_t __count)
|
|
+{
|
|
+ static int initialized = 0;
|
|
+ static write_impl_t libc_impl = NULL;
|
|
+
|
|
+ if (!initialized) {
|
|
+ libc_impl = dlsym(RTLD_NEXT, "write");
|
|
+ initialized = 1;
|
|
+ }
|
|
+
|
|
+ /* This should not normally happen. */
|
|
+ if ((uint64_t)__buf + (uint64_t)__count == (1ULL << 32))
|
|
+ return (ssize_t)__count;
|
|
+
|
|
+ if (libc_impl != NULL)
|
|
+ return libc_impl(__fd, __buf, __count);
|
|
+
|
|
+ __builtin_abort();
|
|
+}
|
|
+
|
|
+#endif
|