Ignore errors when trying to kill wpa_supplicant
This commit is contained in:
@@ -16,6 +16,7 @@ import be.mygod.vpnhotspot.util.Services
|
|||||||
import eu.chainfire.librootjava.RootJava
|
import eu.chainfire.librootjava.RootJava
|
||||||
import kotlinx.android.parcel.Parcelize
|
import kotlinx.android.parcel.Parcelize
|
||||||
import java.io.File
|
import java.io.File
|
||||||
|
import java.io.IOException
|
||||||
|
|
||||||
object RepeaterCommands {
|
object RepeaterCommands {
|
||||||
@Parcelize
|
@Parcelize
|
||||||
@@ -60,8 +61,12 @@ object RepeaterCommands {
|
|||||||
override suspend fun execute(): Parcelable? {
|
override suspend fun execute(): Parcelable? {
|
||||||
File(if (legacy) CONF_PATH_LEGACY else CONF_PATH_TREBLE).writeText(data)
|
File(if (legacy) CONF_PATH_LEGACY else CONF_PATH_TREBLE).writeText(data)
|
||||||
for (process in File("/proc").listFiles { _, name -> TextUtils.isDigitsOnly(name) }!!) {
|
for (process in File("/proc").listFiles { _, name -> TextUtils.isDigitsOnly(name) }!!) {
|
||||||
if (File(File(process, "cmdline").inputStream().bufferedReader().readText()
|
val cmdline = try {
|
||||||
.split(Char.MIN_VALUE, limit = 2).first()).name == "wpa_supplicant") {
|
File(process, "cmdline").inputStream().bufferedReader().readText()
|
||||||
|
} catch (_: IOException) {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
if (File(cmdline.split(Char.MIN_VALUE, limit = 2).first()).name == "wpa_supplicant") {
|
||||||
Os.kill(process.name.toInt(), OsConstants.SIGTERM)
|
Os.kill(process.name.toInt(), OsConstants.SIGTERM)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user