Set SOCK_CLOEXEC when creating netlink socket

- So that the socket is not shared across execs

Signed-off-by: Alessandro Boch <aboch@docker.com>
This commit is contained in:
Alessandro Boch 2017-03-28 21:43:56 -07:00 committed by Vish Ishaya
parent d71ebad8a5
commit c682914b0b

View File

@ -451,7 +451,7 @@ type NetlinkSocket struct {
}
func getNetlinkSocket(protocol int) (*NetlinkSocket, error) {
fd, err := syscall.Socket(syscall.AF_NETLINK, syscall.SOCK_RAW, protocol)
fd, err := syscall.Socket(syscall.AF_NETLINK, syscall.SOCK_RAW|syscall.SOCK_CLOEXEC, protocol)
if err != nil {
return nil, err
}