summaryrefslogtreecommitdiff
path: root/sd_daemon/notify.go
diff options
context:
space:
mode:
Diffstat (limited to 'sd_daemon/notify.go')
-rw-r--r--sd_daemon/notify.go11
1 files changed, 7 insertions, 4 deletions
diff --git a/sd_daemon/notify.go b/sd_daemon/notify.go
index fcd8060..b0a0d72 100644
--- a/sd_daemon/notify.go
+++ b/sd_daemon/notify.go
@@ -1,6 +1,6 @@
// Copyright 2013-2015 Docker, Inc.
// Copyright 2014 CoreOS, Inc.
-// Copyright 2015-2017 Luke Shumaker
+// Copyright 2015-2018 Luke Shumaker
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
@@ -14,6 +14,8 @@
// See the License for the specific language governing permissions and
// limitations under the License.
+// +build linux
+
package sd_daemon
import (
@@ -29,11 +31,11 @@ import (
type Notification struct {
// PID specifies which process to send a notification about.
// If PID <= 0, or if the current process does not have
- // priveleges to send messages on behalf of other processes,
+ // privileges to send messages on behalf of other processes,
// then the message is simply sent from the current process.
PID int
- // State should countain a newline-separated list of variable
+ // State should contain a newline-separated list of variable
// assignments. See the documentation for sd_notify(3) for
// well-known variable assignments.
//
@@ -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