[PATCH 2/2] Bubble up the error in attempting to delete the interface after attempting to set the interface name has failed.

jwriteclub at gmail.com jwriteclub at gmail.com
Tue May 21 10:17:16 CEST 2019


From: Christopher O'Connell <jwriteclub at gmail.com>

---
 tun/tun_windows.go | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/tun/tun_windows.go b/tun/tun_windows.go
index c1c7de7..6d79ba9 100644
--- a/tun/tun_windows.go
+++ b/tun/tun_windows.go
@@ -79,7 +79,10 @@ func CreateTUN(ifname string) (TUNDevice, error) {
 
 	err = wt.SetInterfaceName(ifname)
 	if err != nil {
-		wt.DeleteInterface(0)
+		_, _, err2 := wt.DeleteInterface(0)
+		if err2 != nil {
+			return nil,fmt.Errorf("Unable to delete Wintun interface after failing to set name: %v: %v", err2, err)
+		}
 		return nil, fmt.Errorf("Unable to set name of Wintun interface: %v", err)
 	}
 
-- 
2.21.0.windows.1



More information about the WireGuard mailing list