3
0
Fork 0
forked from mirrors/nixpkgs

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
This commit is contained in:
aszlig 2018-11-12 13:08:22 +01:00
parent 22a802584f
commit a815f53c60
No known key found for this signature in database
GPG key ID: 684089CE67EBB691

View file

@ -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");