From a86c4fe93f130752a862ff0a5ee75f073c3586b1 Mon Sep 17 00:00:00 2001 From: Reiner Herrmann Date: Sun, 23 Oct 2022 15:51:28 +0200 Subject: check for availability of symbols instead of glibc defines in musl they are just redefines of the non-64 versions --- src/libtrace/libtrace.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'src/libtrace') diff --git a/src/libtrace/libtrace.c b/src/libtrace/libtrace.c index c0832cbde..aa37bb758 100644 --- a/src/libtrace/libtrace.c +++ b/src/libtrace/libtrace.c @@ -44,8 +44,6 @@ // break recursivity on fopen call typedef FILE *(*orig_fopen_t)(const char *pathname, const char *mode); static orig_fopen_t orig_fopen = NULL; -typedef FILE *(*orig_fopen64_t)(const char *pathname, const char *mode); -static orig_fopen64_t orig_fopen64 = NULL; typedef int (*orig_access_t)(const char *pathname, int mode); static orig_access_t orig_access = NULL; @@ -341,7 +339,9 @@ FILE *fopen(const char *pathname, const char *mode) { return rv; } -#ifdef __GLIBC__ +#ifndef fopen64 +typedef FILE *(*orig_fopen64_t)(const char *pathname, const char *mode); +static orig_fopen64_t orig_fopen64 = NULL; FILE *fopen64(const char *pathname, const char *mode) { if (!orig_fopen64) orig_fopen64 = (orig_fopen_t)dlsym(RTLD_NEXT, "fopen64"); @@ -350,7 +350,7 @@ FILE *fopen64(const char *pathname, const char *mode) { tprintf(ftty, "%u:%s:fopen64 %s:%p\n", mypid, myname, pathname, rv); return rv; } -#endif /* __GLIBC__ */ +#endif // freopen @@ -365,7 +365,7 @@ FILE *freopen(const char *pathname, const char *mode, FILE *stream) { return rv; } -#ifdef __GLIBC__ +#ifndef freopen64 typedef FILE *(*orig_freopen64_t)(const char *pathname, const char *mode, FILE *stream); static orig_freopen64_t orig_freopen64 = NULL; FILE *freopen64(const char *pathname, const char *mode, FILE *stream) { @@ -376,7 +376,7 @@ FILE *freopen64(const char *pathname, const char *mode, FILE *stream) { tprintf(ftty, "%u:%s:freopen64 %s:%p\n", mypid, myname, pathname, rv); return rv; } -#endif /* __GLIBC__ */ +#endif // unlink typedef int (*orig_unlink_t)(const char *pathname); @@ -447,7 +447,7 @@ int stat(const char *pathname, struct stat *statbuf) { return rv; } -#ifdef __GLIBC__ +#ifndef stat64 typedef int (*orig_stat64_t)(const char *pathname, struct stat64 *statbuf); static orig_stat64_t orig_stat64 = NULL; int stat64(const char *pathname, struct stat64 *statbuf) { @@ -458,7 +458,7 @@ int stat64(const char *pathname, struct stat64 *statbuf) { tprintf(ftty, "%u:%s:stat64 %s:%d\n", mypid, myname, pathname, rv); return rv; } -#endif /* __GLIBC__ */ +#endif // lstat typedef int (*orig_lstat_t)(const char *pathname, struct stat *statbuf); @@ -472,7 +472,7 @@ int lstat(const char *pathname, struct stat *statbuf) { return rv; } -#ifdef __GLIBC__ +#ifndef lstat64 typedef int (*orig_lstat64_t)(const char *pathname, struct stat64 *statbuf); static orig_lstat64_t orig_lstat64 = NULL; int lstat64(const char *pathname, struct stat64 *statbuf) { @@ -483,7 +483,7 @@ int lstat64(const char *pathname, struct stat64 *statbuf) { tprintf(ftty, "%u:%s:lstat64 %s:%d\n", mypid, myname, pathname, rv); return rv; } -#endif /* __GLIBC__ */ +#endif // opendir typedef DIR *(*orig_opendir_t)(const char *pathname); -- cgit v1.2.3-54-g00ecf