diff options
author | Jason A. Donenfeld <Jason@zx2c4.com> | 2021-06-22 19:54:26 +0200 |
---|---|---|
committer | Jason A. Donenfeld <Jason@zx2c4.com> | 2021-06-22 19:56:14 +0200 |
commit | e99d28cf81a6d39a8ea102de48d1cd866ad351db (patch) | |
tree | ce194526397dcc82a482b195b578f0e9580cb9a2 /manager | |
parent | version: bump (diff) | |
download | wireguard-windows-e99d28cf81a6d39a8ea102de48d1cd866ad351db.tar.xz wireguard-windows-e99d28cf81a6d39a8ea102de48d1cd866ad351db.zip |
manager: do not terminate current process when intended target is child
If we've already collected this, handle is -1, which is current process.
Catch this case.
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Diffstat (limited to 'manager')
-rw-r--r-- | manager/uiprocess.go | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/manager/uiprocess.go b/manager/uiprocess.go index 80ac8b30..08c29f40 100644 --- a/manager/uiprocess.go +++ b/manager/uiprocess.go @@ -95,5 +95,9 @@ func (p *uiProcess) Wait() (uint32, error) { } func (p *uiProcess) Kill() error { - return windows.TerminateProcess(windows.Handle(atomic.LoadUintptr(&p.handle)), 1) + handle := windows.Handle(atomic.LoadUintptr(&p.handle)) + if handle == windows.InvalidHandle { + return nil + } + return windows.TerminateProcess(handle, 1) } |