mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
Merge pull request #4 from tianon/slight-netlink-cleanup
Update NetworkChangeName to be more similar to my original
This commit is contained in:
commit
ccf2b96fbc
1 changed files with 4 additions and 2 deletions
|
@ -662,15 +662,17 @@ func getIfSocket() (int, error) {
|
|||
return -1, sErr
|
||||
}
|
||||
|
||||
// from <net/if.h>
|
||||
const IFNAMSIZ = 16
|
||||
|
||||
func NetworkChangeName(oldName, newName string) error {
|
||||
fd, err := getIfSocket()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
defer syscall.Close(fd)
|
||||
IFNAMSIZ := 16
|
||||
|
||||
data := [32]byte{}
|
||||
data := [IFNAMSIZ * 2]byte{}
|
||||
copy(data[:IFNAMSIZ-1], oldName)
|
||||
copy(data[IFNAMSIZ:IFNAMSIZ*2-1], newName)
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue