Fix code duplication

This commit is contained in:
Jason A. Donenfeld 2018-05-22 14:59:29 +02:00
parent dd663a7ba4
commit 794e494802

View File

@ -340,11 +340,6 @@ func CreateTUNFromFile(file *os.File) (TUNDevice, error) {
return nil, err return nil, err
} }
if err != nil {
tun.fd.Close()
return nil, err
}
tun.rwcancel, err = rwcancel.NewRWCancel(int(file.Fd())) tun.rwcancel, err = rwcancel.NewRWCancel(int(file.Fd()))
if err != nil { if err != nil {
tun.fd.Close() tun.fd.Close()