summaryrefslogtreecommitdiffhomepage
path: root/tunnel/tools/libwg-go/api-android.go
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2021-02-11 16:00:28 +0100
committerJason A. Donenfeld <Jason@zx2c4.com>2021-02-11 16:00:28 +0100
commit4c3289aa52415a02f2d3d4e3c51983c61ff49c02 (patch)
tree9964dc6cd51a0e62141a3e2d24c4a517db3aa47e /tunnel/tools/libwg-go/api-android.go
parent79376bca649343ef97857cac6917e3557eaa9ced (diff)
tunnel: bump all tools
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Diffstat (limited to 'tunnel/tools/libwg-go/api-android.go')
-rw-r--r--tunnel/tools/libwg-go/api-android.go12
1 files changed, 10 insertions, 2 deletions
diff --git a/tunnel/tools/libwg-go/api-android.go b/tunnel/tools/libwg-go/api-android.go
index aaca0b74..5fce4705 100644
--- a/tunnel/tools/libwg-go/api-android.go
+++ b/tunnel/tools/libwg-go/api-android.go
@@ -119,7 +119,13 @@ func wgTurnOn(interfaceName string, tunFd int32, settings string) int32 {
}
}
- device.Up()
+ err = device.Up()
+ if err != nil {
+ logger.Errorf("Unable to bring up device: %v", err)
+ uapiFile.Close()
+ device.Close()
+ return -1
+ }
logger.Verbosef("Device started")
var i int32
@@ -129,7 +135,9 @@ func wgTurnOn(interfaceName string, tunFd int32, settings string) int32 {
}
}
if i == math.MaxInt32 {
- unix.Close(int(tunFd))
+ logger.Errorf("Unable to find empty handle")
+ uapiFile.Close()
+ device.Close()
return -1
}
tunnelHandles[i] = TunnelHandle{device: device, uapi: uapi}