summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuke Shumaker <lukeshu@sbcglobal.net>2017-01-01 19:16:48 -0700
committerLuke Shumaker <lukeshu@sbcglobal.net>2017-01-01 19:16:48 -0700
commit346605c8cfdcdc39d7b614f114877b411fa63bda (patch)
tree7591ee3e4a9a620916802373802f5af378be7ca3
parent60f22426d52ac3e2b746619bd57298813c4822dc (diff)
Update for new libsystemd.
-rw-r--r--nslcd_systemd/nslcd_systemd.go13
1 files changed, 6 insertions, 7 deletions
diff --git a/nslcd_systemd/nslcd_systemd.go b/nslcd_systemd/nslcd_systemd.go
index 35c9393..65c0331 100644
--- a/nslcd_systemd/nslcd_systemd.go
+++ b/nslcd_systemd/nslcd_systemd.go
@@ -42,7 +42,6 @@ import (
"golang.org/x/sys/unix"
"lukeshu.com/git/go/libnslcd.git/nslcd_server"
"lukeshu.com/git/go/libsystemd.git/sd_daemon"
- "lukeshu.com/git/go/libsystemd.git/sd_daemon/lsb"
)
type Backend interface {
@@ -107,7 +106,7 @@ func Main(backend Backend) uint8 {
if err != nil {
sd_daemon.Log.Err(fmt.Sprintf("Could not initialize backend: %v", err))
sd_daemon.Notify(0, false, "STOPPING=1", nil)
- return lsb.EXIT_FAILURE
+ return sd_daemon.EXIT_FAILURE
}
defer backend.Close()
@@ -115,12 +114,12 @@ func Main(backend Backend) uint8 {
if err != nil {
sd_daemon.Log.Err(fmt.Sprintf("%v", err))
sd_daemon.Notify(0, false, "STOPPING=1", nil)
- return lsb.EXIT_NOTRUNNING
+ return sd_daemon.EXIT_NOTRUNNING
}
defer socket.Close()
sock := make(chan *net.UnixConn)
go func() {
- defer lsb.Recover()
+ defer sd_daemon.Recover()
for {
conn, err := socket.Accept()
if err != nil {
@@ -142,20 +141,20 @@ func Main(backend Backend) uint8 {
switch sig {
case unix.SIGTERM:
sd_daemon.Log.Notice("Received SIGTERM, shutting down")
- return lsb.EXIT_SUCCESS
+ return sd_daemon.EXIT_SUCCESS
case unix.SIGHUP:
sd_daemon.Notify(0, false, "RELOADING=1", nil)
err := backend.Reload()
if err != nil {
sd_daemon.Log.Notice(fmt.Sprintf("Could not reload backend: %s", err.Error()))
- return lsb.EXIT_NOTRUNNING
+ return sd_daemon.EXIT_NOTRUNNING
}
sd_daemon.Notify(0, false, "READY=1", nil)
}
case conn := <-sock:
wg.Add(1)
go func() {
- defer lsb.Recover()
+ defer sd_daemon.Recover()
defer wg.Done()
handler(conn, backend)
}()