Cleanup error handling
This commit is contained in:
parent
5181a06304
commit
470f2f0248
|
@ -157,7 +157,7 @@ func CreateTUN(name string, mtu int) (Device, error) {
|
||||||
|
|
||||||
if errno != 0 {
|
if errno != 0 {
|
||||||
tunfile.Close()
|
tunfile.Close()
|
||||||
return nil, fmt.Errorf("Unable to put into IFHEAD mode: %v", errno)
|
return nil, fmt.Errorf("Unable to put into multi-af mode: %v", errno)
|
||||||
}
|
}
|
||||||
|
|
||||||
_, _, errno = unix.Syscall(
|
_, _, errno = unix.Syscall(
|
||||||
|
@ -169,7 +169,7 @@ func CreateTUN(name string, mtu int) (Device, error) {
|
||||||
|
|
||||||
if errno != 0 || ifheadmode == 0 {
|
if errno != 0 || ifheadmode == 0 {
|
||||||
tunfile.Close()
|
tunfile.Close()
|
||||||
return nil, fmt.Errorf("Unable to validate IFHEAD mode: %v (ifheadmode = %d)", errno, ifheadmode)
|
return nil, fmt.Errorf("Unable to validate multi-af mode: %v", errno)
|
||||||
}
|
}
|
||||||
|
|
||||||
if err == nil && name == "tun" {
|
if err == nil && name == "tun" {
|
||||||
|
|
Loading…
Reference in a new issue