Development discussion of WireGuard
 help / color / mirror / Atom feed
From: jwriteclub@gmail.com
To: wireguard@lists.zx2c4.com
Subject: [PATCH 2/2] Bubble up the error in attempting to delete the interface after attempting to set the interface name has failed.
Date: Tue, 21 May 2019 11:16:48 +0300	[thread overview]
Message-ID: <20190521081648.12160-2-jwriteclub@gmail.com> (raw)
In-Reply-To: <20190521081648.12160-1-jwriteclub@gmail.com>

From: Christopher O'Connell <jwriteclub@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

_______________________________________________
WireGuard mailing list
WireGuard@lists.zx2c4.com
https://lists.zx2c4.com/mailman/listinfo/wireguard

       reply	other threads:[~2019-06-06  9:33 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20190521081648.12160-1-jwriteclub@gmail.com>
2019-05-21  8:16 ` jwriteclub [this message]
2019-06-06 10:15   ` Jason A. Donenfeld

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190521081648.12160-2-jwriteclub@gmail.com \
    --to=jwriteclub@gmail.com \
    --cc=wireguard@lists.zx2c4.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).