From 74696ceba3704a68208993305c1d89377f3bc0c8 Mon Sep 17 00:00:00 2001 From: Mygod Date: Sat, 2 Feb 2019 02:54:36 +0800 Subject: [PATCH] Refine DhcpWorkaround error processing --- .../main/java/be/mygod/vpnhotspot/net/DhcpWorkaround.kt | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/mobile/src/main/java/be/mygod/vpnhotspot/net/DhcpWorkaround.kt b/mobile/src/main/java/be/mygod/vpnhotspot/net/DhcpWorkaround.kt index 39475629..3ee3e27d 100644 --- a/mobile/src/main/java/be/mygod/vpnhotspot/net/DhcpWorkaround.kt +++ b/mobile/src/main/java/be/mygod/vpnhotspot/net/DhcpWorkaround.kt @@ -28,11 +28,10 @@ object DhcpWorkaround : SharedPreferences.OnSharedPreferenceChangeListener { try { RootSession.use { it.exec("ip rule $action iif lo uidrange 0-0 lookup local_network priority 11000") } } catch (e: RootSession.UnexpectedOutputException) { - if (e.result.out.isEmpty() && if (enabled) { - e.result.code == 2 && e.result.err.joinToString("\n") == "RTNETLINK answers: File exists" + if (e.result.out.isEmpty() && (e.result.code == 2 || e.result.code == 254) && if (enabled) { + e.result.err.joinToString("\n") == "RTNETLINK answers: File exists" } else { - e.result.code == 254 && - e.result.err.joinToString("\n") == "RTNETLINK answers: No such file or directory" + e.result.err.joinToString("\n") == "RTNETLINK answers: No such file or directory" }) return Timber.w(e) SmartSnackbar.make(e).show()