From a0c6efb9fd23b8e9b44a123252afc863b88eb8d7 Mon Sep 17 00:00:00 2001 From: Jan Tojnar Date: Sat, 4 May 2019 05:53:18 +0200 Subject: [PATCH] libredirect: remove dlopen support While it might be useful in some cases, there are too many caveats to be worth it. When libredirect intercepts dlopen call and calls the original function, the dynamic loader will use libredirect.so's DT_RUNPATH entry instead of the one from the ELF file the dlopen call originated from. That means that when program tries to dlopen a library that it expects to find on its RPATH, the call will fail. This broke Sublime Text for just that reason. --- pkgs/build-support/libredirect/libredirect.c | 7 ------- 1 file changed, 7 deletions(-) diff --git a/pkgs/build-support/libredirect/libredirect.c b/pkgs/build-support/libredirect/libredirect.c index dcf3a2016bc2..655399af58f5 100644 --- a/pkgs/build-support/libredirect/libredirect.c +++ b/pkgs/build-support/libredirect/libredirect.c @@ -166,10 +166,3 @@ int execv(const char *path, char *const argv[]) char buf[PATH_MAX]; return execv_real(rewrite(path, buf), argv); } - -void *dlopen(const char *filename, int flag) -{ - void * (*__dlopen_real) (const char *, int) = dlsym(RTLD_NEXT, "dlopen"); - char buf[PATH_MAX]; - return __dlopen_real(rewrite(filename, buf), flag); -}