mirror of
https://git.zx2c4.com/wireguard-go
synced 2024-11-15 01:05:15 +01:00
Merge branch 'master' of ssh://git.zx2c4.com/wireguard-go
This commit is contained in:
commit
4d9f3a2f53
@ -19,6 +19,7 @@ import (
|
|||||||
"net"
|
"net"
|
||||||
"os"
|
"os"
|
||||||
"strconv"
|
"strconv"
|
||||||
|
"bytes"
|
||||||
"strings"
|
"strings"
|
||||||
"syscall"
|
"syscall"
|
||||||
"time"
|
"time"
|
||||||
@ -268,7 +269,12 @@ func (tun *NativeTun) Name() (string, error) {
|
|||||||
if errno != 0 {
|
if errno != 0 {
|
||||||
return "", errors.New("Failed to get name of TUN device: " + strconv.FormatInt(int64(errno), 10))
|
return "", errors.New("Failed to get name of TUN device: " + strconv.FormatInt(int64(errno), 10))
|
||||||
}
|
}
|
||||||
tun.name = string(ifr[:])
|
nullStr := ifr[:]
|
||||||
|
i := bytes.IndexByte(nullStr, 0)
|
||||||
|
if i != -1 {
|
||||||
|
nullStr = nullStr[:i]
|
||||||
|
}
|
||||||
|
tun.name = string(nullStr)
|
||||||
return tun.name, nil
|
return tun.name, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user