[lxc-devel] [lxd/master] lxd/shutdown: Fix error string check
stgraber on Github
lxc-bot at linuxcontainers.org
Tue Mar 6 22:15:37 UTC 2018
A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 354 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20180306/003e381f/attachment.bin>
-------------- next part --------------
From 750694e890d929a0dbccd3521b498e48cc091c9a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?St=C3=A9phane=20Graber?= <stgraber at ubuntu.com>
Date: Tue, 6 Mar 2018 23:14:48 +0100
Subject: [PATCH] lxd/shutdown: Fix error string check
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Signed-off-by: Stéphane Graber <stgraber at ubuntu.com>
---
lxd/main_shutdown.go | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/lxd/main_shutdown.go b/lxd/main_shutdown.go
index 3de15e3ec0..53f80366b2 100644
--- a/lxd/main_shutdown.go
+++ b/lxd/main_shutdown.go
@@ -2,7 +2,7 @@ package main
import (
"fmt"
- "io"
+ "strings"
"time"
"github.com/lxc/lxd/client"
@@ -18,7 +18,7 @@ func cmdShutdown(args *Args) error {
}
_, _, err = c.RawQuery("PUT", "/internal/shutdown", nil, "")
- if err != nil && err != io.EOF {
+ if err != nil && strings.HasSuffix(err.Error(), ": EOF") {
// NOTE: if we got an EOF error here it means that the daemon
// has shutdown so quickly that it already closed the unix
// socket. We consider the daemon dead in this case.
More information about the lxc-devel
mailing list