From f20fbbd6996653d2e03dbc7e3932508a88aaa15c Mon Sep 17 00:00:00 2001 From: Fredrik Fornwall Date: Mon, 30 Sep 2024 21:18:00 +0200 Subject: [PATCH] Setup LD_PRELOAD to point at termux-exec at startup Fixes https://github.com/termux/termux-packages/issues/21576 --- app/src/main/cpp/lorie/android.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/app/src/main/cpp/lorie/android.c b/app/src/main/cpp/lorie/android.c index 33ced72b..3b14d81e 100644 --- a/app/src/main/cpp/lorie/android.c +++ b/app/src/main/cpp/lorie/android.c @@ -175,6 +175,9 @@ Java_com_termux_x11_CmdEntryPoint_start(JNIEnv *env, __unused jclass cls, jobjec execlp("logcat", "logcat", "--pid", pid, NULL); } + if (access("/data/data/com.termux/files/usr/lib/libtermux-exec.so", F_OK) == 0) + setenv("LD_PRELOAD", "/data/data/com.termux/files/usr/lib/libtermux-exec.so", 1); + // adb sets TMPDIR to /data/local/tmp which is pretty useless. if (!strcmp("/data/local/tmp", getenv("TMPDIR") ?: "")) unsetenv("TMPDIR");