We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 0e9837f + 40d619f commit 7999964Copy full SHA for 7999964
reader.go
@@ -56,11 +56,16 @@ func NewReader() (io.ReadCloser, error) {
56
syscall.SOCK_RAW,
57
NETLINK_KOBJECT_UEVENT,
58
)
59
-
60
if err != nil {
61
return nil, err
62
}
63
+ // os/exec does not close existing file descriptors by convention as per
64
+ // https://github.com/golang/go/blob/release-branch.go1.14/src/syscall/exec_linux.go#L483
65
+ // so explicitly mark this file descriptor as close-on-exec to avoid leaking
66
+ // it to child processes accidentally.
67
+ syscall.CloseOnExec(fd)
68
+
69
nl := syscall.SockaddrNetlink{
70
Family: syscall.AF_NETLINK,
71
Pid: uint32(os.Getpid()),
0 commit comments