]> granicus.if.org Git - strace/commitdiff
unwind: use fopen64 instead of fopen
authorDmitry V. Levin <ldv@altlinux.org>
Thu, 5 Jun 2014 15:12:42 +0000 (15:12 +0000)
committerDmitry V. Levin <ldv@altlinux.org>
Thu, 5 Jun 2014 15:42:05 +0000 (15:42 +0000)
* unwind.c (fopen_for_input): Define to fopen64 iff
[_LARGEFILE64_SOURCE && HAVE_FOPEN64], otherwise define it to fopen.
(build_mmap_cache): Use fopen_for_input instead of fopen.

unwind.c

index 21f2a481866718af13720875a5cb544a4b7335da..d23fef6672b5d5b5693bb93324b1fb23c94bff6c 100644 (file)
--- a/unwind.c
+++ b/unwind.c
 #include <limits.h>
 #include <libunwind-ptrace.h>
 
+#ifdef _LARGEFILE64_SOURCE
+# ifdef HAVE_FOPEN64
+#  define fopen_for_input fopen64
+# else
+#  define fopen_for_input fopen
+# endif
+#else
+# define fopen_for_input fopen
+#endif
+
 #define DPRINTF(F, A, ...) if (debug_flag) fprintf(stderr, " [unwind(" A ")] " F "\n", __VA_ARGS__)
 
 /*
@@ -143,7 +153,7 @@ build_mmap_cache(struct tcb* tcp)
        unw_flush_cache (libunwind_as, 0, 0);
 
        sprintf(filename, "/proc/%d/maps", tcp->pid);
-       fp = fopen(filename, "r");
+       fp = fopen_for_input(filename, "r");
        if (!fp) {
                perror_msg("fopen: %s", filename);
                return;