From 801164566924c41d18d66bdc9ca8b2305103fb82 Mon Sep 17 00:00:00 2001 From: netblue30 Date: Sun, 25 Oct 2015 09:27:34 -0400 Subject: fix struct stat64 problem for musl libc --- src/libtrace/libtrace.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'src/libtrace/libtrace.c') diff --git a/src/libtrace/libtrace.c b/src/libtrace/libtrace.c index 1eb1cf931..2ce74d331 100644 --- a/src/libtrace/libtrace.c +++ b/src/libtrace/libtrace.c @@ -18,7 +18,11 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ #define _GNU_SOURCE +#ifdef HAVE_MUSL_LIBC +#include "musl_defs.h" +#else #include +#endif #include #include #include @@ -28,7 +32,9 @@ #include #include #include +#ifndef HAVE_MUSL_LIBC #include +#endif // break recursivity on fopen call typedef FILE *(*orig_fopen_t)(const char *pathname, const char *mode); @@ -414,9 +420,17 @@ int stat(const char *pathname, struct stat *buf) { return rv; } +#ifdef HAVE_MUSL_LIBC +typedef int (*orig_stat64_t)(const char *pathname, struct stat *buf); +#else typedef int (*orig_stat64_t)(const char *pathname, struct stat64 *buf); +#endif static orig_stat64_t orig_stat64 = NULL; +#ifdef HAVE_MUSL_LIBC +int stat64(const char *pathname, struct stat *buf) { +#else int stat64(const char *pathname, struct stat64 *buf) { +#endif if (!orig_stat) orig_stat64 = (orig_stat64_t)dlsym(RTLD_NEXT, "stat"); -- cgit v1.2.3-70-g09d2