From b438f0aec8615ee13d5cbc8ed44cd6ff4a49942c Mon Sep 17 00:00:00 2001 From: Dongsu Park Date: Thu, 21 Jul 2016 08:21:03 +0200 Subject: [PATCH] etcdmain: correctly check return values from SdNotify() SdNotify() now returns 2 values, sent and err. So startEtcdOrProxyV2() needs to check the 2 return values correctly. As the 2 values are independent of each other, error checking needs to be slightly updated too. SdNotifyNoSocket, which was previously provided by go-systemd, does not exist any more. In that case (false, nil) will be returned instead. --- etcdmain/etcd.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/etcdmain/etcd.go b/etcdmain/etcd.go index adba4cd98e03..f36a9a6e2b8c 100644 --- a/etcdmain/etcd.go +++ b/etcdmain/etcd.go @@ -160,12 +160,12 @@ func startEtcdOrProxyV2() { // for accepting connections. The etcd instance should be // joined with the cluster and ready to serve incoming // connections. - err := daemon.SdNotify("READY=1") + sent, err := daemon.SdNotify("READY=1") if err != nil { plog.Errorf("failed to notify systemd for readiness: %v", err) - if err == daemon.SdNotifyNoSocket { - plog.Errorf("forgot to set Type=notify in systemd service file?") - } + } + if !sent { + plog.Errorf("forgot to set Type=notify in systemd service file?") } }