]> granicus.if.org Git - strace/commitdiff
Fix build with Bionic libc
authorDmitry V. Levin <ldv@altlinux.org>
Wed, 26 Feb 2014 00:01:00 +0000 (00:01 +0000)
committerDmitry V. Levin <ldv@altlinux.org>
Wed, 26 Feb 2014 00:01:00 +0000 (00:01 +0000)
Add generic tests for fopen64 and fputs_unlocked functions to fix build
with Bionic libc that does not provide them.

* configure.ac (AC_CHECK_FUNCS): Add fopen64 and fputs_unlocked.
* strace.c [_LARGEFILE64_SOURCE]: Use fopen instead of fopen64
if !HAVE_FOPEN64.
Use fputs instead of fputs_unlocked if !HAVE_FPUTS_UNLOCKED.
* vsprintf.c: Use fputs instead of fputs_unlocked
if !HAVE_FPUTS_UNLOCKED.

Reported-by: Elliott Hughes <enh@google.com>
configure.ac
strace.c
vsprintf.c

index db24349e53c22a99e671b3a8b60e914cd9c3c8c2..75eafc8ad78cbc0de23e2203c38ca3f45d5d51d9 100644 (file)
@@ -196,7 +196,9 @@ AC_CHECK_MEMBERS([struct sockaddr_in6.sin6_scope_id],,,
 AC_LITTLE_ENDIAN_LONG_LONG
 
 AC_CHECK_FUNCS(m4_normalize([
+       fopen64
        fork
+       fputs_unlocked
        if_indextoname
        inet_ntop
        prctl
index 914b0a6a9fd141b94600b3d02a6caf5abae37a9d..063cb94ae2b9c1ea92ed17b3eeeee675fcf5d9d3 100644 (file)
--- a/strace.c
+++ b/strace.c
@@ -439,7 +439,11 @@ swap_uid(void)
 }
 
 #ifdef _LARGEFILE64_SOURCE
-# define fopen_for_output fopen64
+# ifdef HAVE_FOPEN64
+#  define fopen_for_output fopen64
+# else
+#  define fopen_for_output fopen
+# endif
 # define struct_stat struct stat64
 # define stat_file stat64
 # define struct_dirent struct dirent64
@@ -537,6 +541,10 @@ tprintf(const char *fmt, ...)
        va_end(args);
 }
 
+#ifndef HAVE_FPUTS_UNLOCKED
+# define fputs_unlocked fputs
+#endif
+
 void
 tprints(const char *str)
 {
index 92fe1a7a622a210a8d0f4d7e6307e9e910762820..0125e7205a3199f70bd5e3946da6618847e38f12 100644 (file)
 #include <stdarg.h>
 #include <limits.h>
 
+#ifndef HAVE_FPUTS_UNLOCKED
+# define fputs_unlocked fputs
+#endif
+
 #define noinline_for_stack /*nothing*/
 #define likely(expr)       (expr)
 #define unlikely(expr)     (expr)