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.
This commit is contained in:
Jan Tojnar 2019-05-04 05:53:18 +02:00
parent 6f7e06bd5a
commit a0c6efb9fd
No known key found for this signature in database
GPG Key ID: 7FAB2A15F7A607A4

View File

@ -166,10 +166,3 @@ int execv(const char *path, char *const argv[])
char buf[PATH_MAX]; char buf[PATH_MAX];
return execv_real(rewrite(path, buf), argv); 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);
}