shim: Set LD_PRELOAD for libredirect if enabled

Signed-off-by: Ikey Doherty <ikey@solus-project.com>
This commit is contained in:
Ikey Doherty
2017-10-21 19:46:25 +01:00
parent 474aca0b69
commit 3b01919148
+15
View File
@@ -32,6 +32,13 @@
*/
#define AUDIT_PATH "/usr/\$LIB/liblsi-intercept.so"
/**
* Redirect path is used for the libredirect library to perform internal
* redirections in functions like `open()` where needed to hotfix games
* at runtime.
*/
#define REDIRECT_PATH "/usr/\$LIB/liblsi-redirect.so"
int main(int argc, char **argv)
{
LsiConfig config = { 0 };
@@ -67,6 +74,14 @@ int main(int argc, char **argv)
if (config.use_libintercept) {
setenv("LD_AUDIT", AUDIT_PATH, 1);
}
#endif
#ifdef HAVE_LIBREDIRECT
/* Only use libredirect in combination with native runtime!
* TODO: Respect existing preload libraries?
*/
if (config.use_libredirect) {
setenv("LD_PRELOAD", REDIRECT_PATH, 1);
}
#endif
} else {
/* Only preload when needed. */