summaryrefslogtreecommitdiff
path: root/sd_daemon
diff options
context:
space:
mode:
Diffstat (limited to 'sd_daemon')
-rw-r--r--sd_daemon/listen_fds.go8
-rw-r--r--sd_daemon/notify.go4
2 files changed, 6 insertions, 6 deletions
diff --git a/sd_daemon/listen_fds.go b/sd_daemon/listen_fds.go
index 0ddf0d0..e6a81ca 100644
--- a/sd_daemon/listen_fds.go
+++ b/sd_daemon/listen_fds.go
@@ -25,8 +25,8 @@ import (
//#define SD_LISTEN_FDS_START 3
import "C"
-// Returns a list of file descriptors passed in by the service manager
-// as part of the socket-based activation logic.
+// ListenFds returns a list of file descriptors passed in by the
+// service manager as part of the socket-based activation logic.
//
// If unsetEnv is true, then (regarless of whether the function call
// itself succeeds or not) it will unset the environmental variables
@@ -36,8 +36,8 @@ import "C"
// In the case of an error, this function returns nil.
func ListenFds(unsetEnv bool) []*os.File {
if unsetEnv {
- defer os.Unsetenv("LISTEN_PID")
- defer os.Unsetenv("LISTEN_FDS")
+ defer func() { _ = os.Unsetenv("LISTEN_PID") }()
+ defer func() { _ = os.Unsetenv("LISTEN_FDS") }()
}
pid, err := strconv.Atoi(os.Getenv("LISTEN_PID"))
diff --git a/sd_daemon/notify.go b/sd_daemon/notify.go
index 8fce6da..b159a22 100644
--- a/sd_daemon/notify.go
+++ b/sd_daemon/notify.go
@@ -40,7 +40,7 @@ var errNotifyNoSocket = errors.New("No socket")
// assignments.
func Notify(unsetEnv bool, state string) error {
if unsetEnv {
- defer os.Unsetenv("NOTIFY_SOCKET")
+ defer func() { _ = os.Unsetenv("NOTIFY_SOCKET") }()
}
socketAddr := &net.UnixAddr{
@@ -56,7 +56,7 @@ func Notify(unsetEnv bool, state string) error {
if err != nil {
return err
}
- defer conn.Close()
+ defer func() { _ = conn.Close() }()
_, err = conn.Write([]byte(state))
return err