Merge branch 'add-netlink-functions' of github.com:crosbymichael/docker into add-netlink-functions

Docker-DCO-1.1-Signed-off-by: Michael Crosby <michael@crosbymichael.com> (github: crosbymichael)
This commit is contained in:
Michael Crosby 2014-02-11 03:33:18 -08:00
commit 43a219048a

View file

@ -732,6 +732,8 @@ func NetworkChangeName(iface *net.Interface, newName string) error {
defer syscall.Close(fd) defer syscall.Close(fd)
data := [IFNAMSIZ * 2]byte{} data := [IFNAMSIZ * 2]byte{}
// the "-1"s here are very important for ensuring we get proper null
// termination of our new C strings
copy(data[:IFNAMSIZ-1], iface.Name) copy(data[:IFNAMSIZ-1], iface.Name)
copy(data[IFNAMSIZ:IFNAMSIZ*2-1], newName) copy(data[IFNAMSIZ:IFNAMSIZ*2-1], newName)