From 488cb85b4c91bbbb362a7a97e5cc88b2e849a995 Mon Sep 17 00:00:00 2001 From: aszlig Date: Mon, 12 Nov 2018 13:08:22 +0100 Subject: [PATCH] libredirect: Add preload wrapper for stat() Pull request #50246 was merged a bit too quickly and it was supposed to fix libredirect on Darwin. However it still fails on Darwin because I was using ofborg to check Darwin builds as I don't have Apple hardware. Providing a symbol for stat shouldn't hurt on GNU/Linux but might work on Darwin, because it probably doesn't have __xstat*() but might have a stat() symbol. Signed-off-by: aszlig --- pkgs/build-support/libredirect/libredirect.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/pkgs/build-support/libredirect/libredirect.c b/pkgs/build-support/libredirect/libredirect.c index d1e8f77fb1f662..ba1e6c57e12ef6 100644 --- a/pkgs/build-support/libredirect/libredirect.c +++ b/pkgs/build-support/libredirect/libredirect.c @@ -119,6 +119,13 @@ int __xstat64(int ver, const char * path, struct stat64 * st) return __xstat64_real(ver, rewrite(path, buf), st); } +int stat(const char * path, struct stat * st) +{ + int (*__stat_real) (const char *, struct stat *) = dlsym(RTLD_NEXT, "stat"); + char buf[PATH_MAX]; + return __stat_real(rewrite(path, buf), st); +} + int * access(const char * path, int mode) { int * (*access_real) (const char *, int mode) = dlsym(RTLD_NEXT, "access");