summary refs log tree commit diff
path: root/pkgs
diff options
context:
space:
mode:
authoraszlig <aszlig@nix.build>2018-11-12 13:08:22 +0100
committeraszlig <aszlig@nix.build>2018-11-12 13:31:43 +0100
commita815f53c60b95716309bd711cbc9bf6de4050bcd (patch)
treeb88f17910153e15d762daba68640dee52f3d1e72 /pkgs
parent22a802584f1a77acfbb82ae6d04dc72c10d4fdd7 (diff)
downloadnixpkgs-a815f53c60b95716309bd711cbc9bf6de4050bcd.tar
nixpkgs-a815f53c60b95716309bd711cbc9bf6de4050bcd.tar.gz
nixpkgs-a815f53c60b95716309bd711cbc9bf6de4050bcd.tar.bz2
nixpkgs-a815f53c60b95716309bd711cbc9bf6de4050bcd.tar.lz
nixpkgs-a815f53c60b95716309bd711cbc9bf6de4050bcd.tar.xz
nixpkgs-a815f53c60b95716309bd711cbc9bf6de4050bcd.tar.zst
nixpkgs-a815f53c60b95716309bd711cbc9bf6de4050bcd.zip
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 failed on Darwin and this
was missed by the person merging the pull request.

The reason this was failing was that there is no __xstat* on Darwin.

So I'm adding a wrapper for stat() as well as it works on Darwin and it
still doesn't hurt on GNU/Linux.

Signed-off-by: aszlig <aszlig@nix.build>
Cc: @edolstra, @zimbatm
Diffstat (limited to 'pkgs')
-rw-r--r--pkgs/build-support/libredirect/libredirect.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/pkgs/build-support/libredirect/libredirect.c b/pkgs/build-support/libredirect/libredirect.c
index d1e8f77fb1f..ba1e6c57e12 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");