wintun: keep original error when Wintun session start fails

Signed-off-by: Simon Rozman <simon@rozman.si>
This commit is contained in:
Simon Rozman 2020-11-25 12:37:02 +01:00 committed by Jason A. Donenfeld
parent da19db415a
commit 4cc7a7a455

View file

@ -104,7 +104,7 @@ func CreateTUNWithRequestedGUID(ifname string, requestedGUID *windows.GUID, mtu
tun.session, err = wt.StartSession(0x800000) // Ring capacity, 8 MiB tun.session, err = wt.StartSession(0x800000) // Ring capacity, 8 MiB
if err != nil { if err != nil {
_, err = tun.wt.Delete(false) tun.wt.Delete(false)
close(tun.events) close(tun.events)
return nil, fmt.Errorf("Error starting session: %w", err) return nil, fmt.Errorf("Error starting session: %w", err)
} }