Update NetworkChangeName to be more similar to my original (moving IFNAMSIZ constant outside the function like it should've been)

Docker-DCO-1.1-Signed-off-by: Andrew Page <admwiggin@gmail.com> (github: tianon)
This commit is contained in:
Tianon Gravi 2014-02-09 18:12:43 -07:00
parent 4f9817a3ca
commit e44920cbe6

View file

@ -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)