diff options
author | Luke Shumaker <lukeshu@datawire.io> | 2018-12-19 07:56:36 -0800 |
---|---|---|
committer | Luke Shumaker <lukeshu@datawire.io> | 2018-12-19 11:00:21 -0500 |
commit | 17934614d3030eeebda44b88ce3061d26199a438 (patch) | |
tree | f0d50ca071485be0f1f09e9317573a2b8efd4abe /sd_daemon/notify.go | |
parent | 1e84510c24b467de60f3938a365b5085457c50a3 (diff) |
sd_daemon: Fix build on macOS, fix FD leak on Linux
Diffstat (limited to 'sd_daemon/notify.go')
-rw-r--r-- | sd_daemon/notify.go | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/sd_daemon/notify.go b/sd_daemon/notify.go index 62e507f..b0a0d72 100644 --- a/sd_daemon/notify.go +++ b/sd_daemon/notify.go @@ -14,6 +14,8 @@ // See the License for the specific language governing permissions and // limitations under the License. +// +build linux + package sd_daemon import ( @@ -142,8 +144,9 @@ func (msg Notification) Send(unsetEnv bool) error { func socketUnixgram(name string) (*net.UnixConn, error) { fd, err := unix.Socket(unix.AF_UNIX, unix.SOCK_DGRAM|unix.SOCK_CLOEXEC, 0) if err != nil { - return nil, err + return nil, os.NewSyscallError("socket", err) } + defer unix.Close(fd) conn, err := net.FileConn(os.NewFile(uintptr(fd), name)) if err != nil { return nil, err |