From: Jason A. Donenfeld Date: Thu, 18 Jul 2019 17:26:25 +0000 (+0200) Subject: tun: windows: open file at startup time X-Git-Tag: 0.0.20190805~18 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=31ff9c02fec42f38b0e444c41744887a1b9fedaf;p=thirdparty%2Fwireguard-go.git tun: windows: open file at startup time --- diff --git a/tun/tun_windows.go b/tun/tun_windows.go index 86995a7..dff51dd 100644 --- a/tun/tun_windows.go +++ b/tun/tun_windows.go @@ -142,6 +142,15 @@ func CreateTUNWithRequestedGUID(ifname string, requestedGUID *windows.GUID) (Dev return nil, fmt.Errorf("Error creating event: %v", err) } + _, err = tun.getTUN() + if err != nil { + windows.CloseHandle(tun.rings.send.tailMoved) + windows.CloseHandle(tun.rings.receive.tailMoved) + tun.closeTUN() + wt.DeleteInterface() + return nil, err + } + return tun, nil }