diff options
author | Luke Shumaker <lukeshu@datawire.io> | 2019-08-14 22:15:59 -0400 |
---|---|---|
committer | Luke Shumaker <lukeshu@datawire.io> | 2019-08-14 22:20:07 -0400 |
commit | f675d9e62ace7b5a706ce2f499f6a18248a728b4 (patch) | |
tree | 5895348765ca0a41ad40c59c607f41fbf2ff90b1 /sd_daemon/notify_nonlinux.go | |
parent | 8f32f1724fce55699a7a9675390c1c2b292190a4 (diff) |
sd_daemon/notify_*.go:socketUnixgram(): Cross-reference with net
Diffstat (limited to 'sd_daemon/notify_nonlinux.go')
-rw-r--r-- | sd_daemon/notify_nonlinux.go | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/sd_daemon/notify_nonlinux.go b/sd_daemon/notify_nonlinux.go index d09cef0..dc268d3 100644 --- a/sd_daemon/notify_nonlinux.go +++ b/sd_daemon/notify_nonlinux.go @@ -99,6 +99,8 @@ func (msg Notification) send(unsetEnv bool) error { // the high-level interface of "net", and messing around with FileConn // and UnixConn. Maybe we just drop to using unix.Socket and // unix.SendmsgN directly. +// +// See: net/sys_cloexec.go:sysSocket() func socketUnixgram(name string) (*net.UnixConn, error) { syscall.ForkLock.RLock() fd, err := unix.Socket(unix.AF_UNIX, unix.SOCK_DGRAM, 0) @@ -110,9 +112,8 @@ func socketUnixgram(name string) (*net.UnixConn, error) { return nil, os.NewSyscallError("socket", err) } defer unix.Close(fd) - if err = unix.SetNonblock(fd, true); err != nil { - return nil, os.NewSyscallError("setnonblock", err) - } + // Don't bother calling unix.SetNonblock(), net.FileConn() + // will call syscall.SetNonblock(). conn, err := net.FileConn(os.NewFile(uintptr(fd), name)) if err != nil { return nil, err |