aboutsummaryrefslogtreecommitdiffstats
path: root/src/libtrace
diff options
context:
space:
mode:
authorLibravatar Reiner Herrmann <reiner@reiner-h.de>2022-10-23 15:51:28 +0200
committerLibravatar Reiner Herrmann <reiner@reiner-h.de>2022-10-23 17:20:31 +0200
commita86c4fe93f130752a862ff0a5ee75f073c3586b1 (patch)
tree30a4b67b1450fe22831196a435781219b8ba26e7 /src/libtrace
parentinclude limits.h instead of manually defining LINE_MAX (diff)
downloadfirejail-a86c4fe93f130752a862ff0a5ee75f073c3586b1.tar.gz
firejail-a86c4fe93f130752a862ff0a5ee75f073c3586b1.tar.zst
firejail-a86c4fe93f130752a862ff0a5ee75f073c3586b1.zip
check for availability of symbols instead of glibc defines
in musl they are just redefines of the non-64 versions
Diffstat (limited to 'src/libtrace')
-rw-r--r--src/libtrace/libtrace.c20
1 files changed, 10 insertions, 10 deletions
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 @@
44// break recursivity on fopen call 44// break recursivity on fopen call
45typedef FILE *(*orig_fopen_t)(const char *pathname, const char *mode); 45typedef FILE *(*orig_fopen_t)(const char *pathname, const char *mode);
46static orig_fopen_t orig_fopen = NULL; 46static orig_fopen_t orig_fopen = NULL;
47typedef FILE *(*orig_fopen64_t)(const char *pathname, const char *mode);
48static orig_fopen64_t orig_fopen64 = NULL;
49typedef int (*orig_access_t)(const char *pathname, int mode); 47typedef int (*orig_access_t)(const char *pathname, int mode);
50static orig_access_t orig_access = NULL; 48static orig_access_t orig_access = NULL;
51 49
@@ -341,7 +339,9 @@ FILE *fopen(const char *pathname, const char *mode) {
341 return rv; 339 return rv;
342} 340}
343 341
344#ifdef __GLIBC__ 342#ifndef fopen64
343typedef FILE *(*orig_fopen64_t)(const char *pathname, const char *mode);
344static orig_fopen64_t orig_fopen64 = NULL;
345FILE *fopen64(const char *pathname, const char *mode) { 345FILE *fopen64(const char *pathname, const char *mode) {
346 if (!orig_fopen64) 346 if (!orig_fopen64)
347 orig_fopen64 = (orig_fopen_t)dlsym(RTLD_NEXT, "fopen64"); 347 orig_fopen64 = (orig_fopen_t)dlsym(RTLD_NEXT, "fopen64");
@@ -350,7 +350,7 @@ FILE *fopen64(const char *pathname, const char *mode) {
350 tprintf(ftty, "%u:%s:fopen64 %s:%p\n", mypid, myname, pathname, rv); 350 tprintf(ftty, "%u:%s:fopen64 %s:%p\n", mypid, myname, pathname, rv);
351 return rv; 351 return rv;
352} 352}
353#endif /* __GLIBC__ */ 353#endif
354 354
355 355
356// freopen 356// freopen
@@ -365,7 +365,7 @@ FILE *freopen(const char *pathname, const char *mode, FILE *stream) {
365 return rv; 365 return rv;
366} 366}
367 367
368#ifdef __GLIBC__ 368#ifndef freopen64
369typedef FILE *(*orig_freopen64_t)(const char *pathname, const char *mode, FILE *stream); 369typedef FILE *(*orig_freopen64_t)(const char *pathname, const char *mode, FILE *stream);
370static orig_freopen64_t orig_freopen64 = NULL; 370static orig_freopen64_t orig_freopen64 = NULL;
371FILE *freopen64(const char *pathname, const char *mode, FILE *stream) { 371FILE *freopen64(const char *pathname, const char *mode, FILE *stream) {
@@ -376,7 +376,7 @@ FILE *freopen64(const char *pathname, const char *mode, FILE *stream) {
376 tprintf(ftty, "%u:%s:freopen64 %s:%p\n", mypid, myname, pathname, rv); 376 tprintf(ftty, "%u:%s:freopen64 %s:%p\n", mypid, myname, pathname, rv);
377 return rv; 377 return rv;
378} 378}
379#endif /* __GLIBC__ */ 379#endif
380 380
381// unlink 381// unlink
382typedef int (*orig_unlink_t)(const char *pathname); 382typedef int (*orig_unlink_t)(const char *pathname);
@@ -447,7 +447,7 @@ int stat(const char *pathname, struct stat *statbuf) {
447 return rv; 447 return rv;
448} 448}
449 449
450#ifdef __GLIBC__ 450#ifndef stat64
451typedef int (*orig_stat64_t)(const char *pathname, struct stat64 *statbuf); 451typedef int (*orig_stat64_t)(const char *pathname, struct stat64 *statbuf);
452static orig_stat64_t orig_stat64 = NULL; 452static orig_stat64_t orig_stat64 = NULL;
453int stat64(const char *pathname, struct stat64 *statbuf) { 453int stat64(const char *pathname, struct stat64 *statbuf) {
@@ -458,7 +458,7 @@ int stat64(const char *pathname, struct stat64 *statbuf) {
458 tprintf(ftty, "%u:%s:stat64 %s:%d\n", mypid, myname, pathname, rv); 458 tprintf(ftty, "%u:%s:stat64 %s:%d\n", mypid, myname, pathname, rv);
459 return rv; 459 return rv;
460} 460}
461#endif /* __GLIBC__ */ 461#endif
462 462
463// lstat 463// lstat
464typedef int (*orig_lstat_t)(const char *pathname, struct stat *statbuf); 464typedef int (*orig_lstat_t)(const char *pathname, struct stat *statbuf);
@@ -472,7 +472,7 @@ int lstat(const char *pathname, struct stat *statbuf) {
472 return rv; 472 return rv;
473} 473}
474 474
475#ifdef __GLIBC__ 475#ifndef lstat64
476typedef int (*orig_lstat64_t)(const char *pathname, struct stat64 *statbuf); 476typedef int (*orig_lstat64_t)(const char *pathname, struct stat64 *statbuf);
477static orig_lstat64_t orig_lstat64 = NULL; 477static orig_lstat64_t orig_lstat64 = NULL;
478int lstat64(const char *pathname, struct stat64 *statbuf) { 478int lstat64(const char *pathname, struct stat64 *statbuf) {
@@ -483,7 +483,7 @@ int lstat64(const char *pathname, struct stat64 *statbuf) {
483 tprintf(ftty, "%u:%s:lstat64 %s:%d\n", mypid, myname, pathname, rv); 483 tprintf(ftty, "%u:%s:lstat64 %s:%d\n", mypid, myname, pathname, rv);
484 return rv; 484 return rv;
485} 485}
486#endif /* __GLIBC__ */ 486#endif
487 487
488// opendir 488// opendir
489typedef DIR *(*orig_opendir_t)(const char *pathname); 489typedef DIR *(*orig_opendir_t)(const char *pathname);