mirror of
https://github.com/okhsunrog/vpnhide.git
synced 2026-04-28 06:31:27 +00:00
fix(lsposed): surface zygisk module-dir copy errors instead of swallowing them
`cp $ZYGISK_TARGETS $ZYGISK_MODULE_TARGETS 2>/dev/null; true` hid both stderr and the exit code, so a read-only mount or SELinux denial silently broke "edits in the app aren't picked up by zygisk on next app launch" — the user had no signal. Rewrite as `if [ -d ... ]; then cp ... 2>&1; fi`, capture exit and output, and log a warn() only when both indicate a real failure (non-zero exit + non-empty stderr). The dir-not-installed case naturally produces exit=0 + empty output and stays quiet.
This commit is contained in:
parent
d7ef5c7b8f
commit
3c2ea4c1ff
1 changed files with 10 additions and 3 deletions
|
|
@ -149,9 +149,16 @@ internal fun ensureSelfInTargets(selfPkg: String): Boolean {
|
|||
|
||||
addIfMissing(KMOD_TARGETS, "/data/adb/vpnhide_kmod")
|
||||
addIfMissing(ZYGISK_TARGETS, "/data/adb/vpnhide_zygisk")
|
||||
// Zygisk reads targets from module dir (via get_module_dir() fd), not from persistent dir.
|
||||
// Must sync after adding self, otherwise zygisk won't hook us on next launch.
|
||||
suExec("[ -d $ZYGISK_MODULE_DIR ] && cp $ZYGISK_TARGETS $ZYGISK_MODULE_TARGETS 2>/dev/null; true")
|
||||
// Zygisk reads targets from module dir (via get_module_dir() fd), not
|
||||
// from persistent dir. Must sync after adding self, otherwise zygisk
|
||||
// won't hook us on next launch. Surface real `cp` failures (read-only
|
||||
// mount, SELinux denial) — silent failure here used to manifest as
|
||||
// "I edited targets in the app but zygisk didn't pick it up".
|
||||
val (cpExit, cpOut) =
|
||||
suExec("if [ -d $ZYGISK_MODULE_DIR ]; then cp $ZYGISK_TARGETS $ZYGISK_MODULE_TARGETS 2>&1; fi")
|
||||
if (cpExit != 0 && cpOut.isNotBlank()) {
|
||||
VpnHideLog.w(TAG, "ensureSelfInTargets: zygisk module dir copy failed (exit=$cpExit): ${cpOut.trim()}")
|
||||
}
|
||||
suExec("mkdir -p /data/adb/vpnhide_lsposed")
|
||||
addIfMissing(LSPOSED_TARGETS, null)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue