Commit 1d938679 authored by Max Lv's avatar Max Lv

Fix a potential race condition

It's possbile that sendFD succeed in chile thread but failed in main thread.
parent c7576708
...@@ -246,13 +246,9 @@ class VpnService : BaseVpnService(), LocalDnsService.Interface { ...@@ -246,13 +246,9 @@ class VpnService : BaseVpnService(), LocalDnsService.Interface {
cmd += "--dnsgw" cmd += "--dnsgw"
cmd += "127.0.0.1:${DataStore.portLocalDns}" cmd += "127.0.0.1:${DataStore.portLocalDns}"
} }
data.processes.start(cmd) {
try { data.processes.start(cmd)
sendFd(fd)
} catch (e: ErrnoException) {
stopRunner(true, e.message)
}
}
return fd return fd
} }
......
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