Commit 958d387b authored by Mygod's avatar Mygod

Fix su detection

parent eee89774
...@@ -305,9 +305,11 @@ class ShadowsocksNatService extends BaseService { ...@@ -305,9 +305,11 @@ class ShadowsocksNatService extends BaseService {
override def startRunner(profile: Profile) = if (su == null) { override def startRunner(profile: Profile) = if (su == null) {
su = new Shell.Builder().useSU().setWantSTDERR(true).setWatchdogTimeout(10).open((_, exitCode, _) => su = new Shell.Builder().useSU().setWantSTDERR(true).setWatchdogTimeout(10).open((_, exitCode, _) =>
if (exitCode == 0) super.startRunner(profile) else { if (exitCode == 0) super.startRunner(profile) else {
if (su != null) {
Log.wtf(TAG, "libsuperuser#55 has been fixed. Please remove the redundant code.") Log.wtf(TAG, "libsuperuser#55 has been fixed. Please remove the redundant code.")
su.close() su.close()
su = null su = null
}
super.stopRunner(true, getString(R.string.nat_no_root)) super.stopRunner(true, getString(R.string.nat_no_root))
}) })
su.waitForIdle() su.waitForIdle()
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment