[lxc-devel] [lxd/master] Fix version parsing of LXC betas

stgraber on Github lxc-bot at linuxcontainers.org
Fri Mar 2 14:37:18 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/20180302/08c793c2/attachment.bin>
-------------- next part --------------
From 1f8cc377399a3af2a95c7402dc9c5db0f5a78f91 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?St=C3=A9phane=20Graber?= <stgraber at ubuntu.com>
Date: Fri, 2 Mar 2018 09:36:19 -0500
Subject: [PATCH] Fix version parsing of LXC betas
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/util/sys.go | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/lxd/util/sys.go b/lxd/util/sys.go
index cb64982236..054dabb94e 100644
--- a/lxd/util/sys.go
+++ b/lxd/util/sys.go
@@ -91,6 +91,7 @@ func RuntimeLiblxcVersionAtLeast(major int, minor int, micro int) bool {
 	parts := strings.Split(version, ".")
 	partsLen := len(parts)
 	if partsLen == 0 {
+		logger.Errorf("partsLen")
 		return false
 	}
 
@@ -104,12 +105,12 @@ func RuntimeLiblxcVersionAtLeast(major int, minor int, micro int) bool {
 	mic := -1
 
 	for i, v := range parts {
-		num, err := strconv.Atoi(v)
-		if err != nil {
-			return false
+		if i > 2 {
+			break
 		}
 
-		if i > 2 {
+		num, err := strconv.Atoi(v)
+		if err != nil {
 			return false
 		}
 


More information about the lxc-devel mailing list