tun: windows: open file at startup time

This commit is contained in:
Jason A. Donenfeld 2019-07-18 19:26:25 +02:00
parent 1e39c33ab1
commit 31ff9c02fe

View file

@ -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
}