From c2e8fd14eaed3e9291b7327b5092a20cf1c24863 Mon Sep 17 00:00:00 2001 From: Mygod Date: Thu, 8 Mar 2018 23:57:42 -0800 Subject: [PATCH] Fix some issues with some su --- .../be/mygod/vpnhotspot/net/IpNeighbourMonitor.kt | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/mobile/src/main/java/be/mygod/vpnhotspot/net/IpNeighbourMonitor.kt b/mobile/src/main/java/be/mygod/vpnhotspot/net/IpNeighbourMonitor.kt index 81f6f20b..9888a2c3 100644 --- a/mobile/src/main/java/be/mygod/vpnhotspot/net/IpNeighbourMonitor.kt +++ b/mobile/src/main/java/be/mygod/vpnhotspot/net/IpNeighbourMonitor.kt @@ -31,7 +31,7 @@ class IpNeighbourMonitor private constructor() { val monitor = instance ?: return instance = null val process = monitor.monitor - if (process != null) thread(TAG + "-killer") { process.destroy() } + if (process != null) thread("$TAG-killer") { process.destroy() } } } @@ -46,13 +46,13 @@ class IpNeighbourMonitor private constructor() { private var monitor: Process? = null init { - thread(TAG + "-input") { + thread("$TAG-input") { // monitor may get rejected by SELinux - val monitor = ProcessBuilder("sh", "-c", "ip monitor neigh || su -c ip monitor neigh") + val monitor = ProcessBuilder("sh", "-c", "ip monitor neigh || su -c 'ip monitor neigh'") .redirectErrorStream(true) .start() this.monitor = monitor - thread(TAG + "-error") { + thread("$TAG-error") { try { monitor.errorStream.bufferedReader().forEachLine { Log.e(TAG, it) } } catch (ignore: InterruptedIOException) { } @@ -74,12 +74,12 @@ class IpNeighbourMonitor private constructor() { } } - fun flush() = thread(TAG + "-flush") { + fun flush() = thread("$TAG-flush") { val process = ProcessBuilder("ip", "neigh") .redirectErrorStream(true) .start() process.waitFor() - thread(TAG + "-flush-error") { + thread("$TAG-flush-error") { val err = process.errorStream.bufferedReader().readText() if (err.isNotBlank()) { Log.e(TAG, err)