[lxc-devel] [lxd/master] lxd: Satisfy static analysis

monstermunchkin on Github lxc-bot at linuxcontainers.org
Mon Jun 3 16:09:32 UTC 2019


A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 355 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20190603/c9526287/attachment.bin>
-------------- next part --------------
From 9eb14d0c2393d3a3c8bd1bdd6818b26fae256ecd Mon Sep 17 00:00:00 2001
From: Thomas Hipp <thomas.hipp at canonical.com>
Date: Mon, 3 Jun 2019 18:08:14 +0200
Subject: [PATCH] lxd: Satisfy static analysis

Signed-off-by: Thomas Hipp <thomas.hipp at canonical.com>
---
 lxd/patches.go            | 8 ++++----
 lxd/proxy_device_utils.go | 4 ++--
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/lxd/patches.go b/lxd/patches.go
index 084bd11133..54bd9eaad5 100644
--- a/lxd/patches.go
+++ b/lxd/patches.go
@@ -498,7 +498,7 @@ func upgradeFromStorageTypeBtrfs(name string, d *Daemon, defaultPoolName string,
 		return err
 	}
 
-	poolID := int64(-1)
+	var poolID int64
 	pools, err := d.cluster.StoragePools()
 	if err == nil { // Already exist valid storage pools.
 		// Check if the storage pool already has a db entry.
@@ -795,7 +795,7 @@ func upgradeFromStorageTypeDir(name string, d *Daemon, defaultPoolName string, d
 		return err
 	}
 
-	poolID := int64(-1)
+	var poolID int64
 	pools, err := d.cluster.StoragePools()
 	if err == nil { // Already exist valid storage pools.
 		// Check if the storage pool already has a db entry.
@@ -1094,7 +1094,7 @@ func upgradeFromStorageTypeLvm(name string, d *Daemon, defaultPoolName string, d
 	// Peek into the storage pool database to see whether any storage pools
 	// are already configured. If so, we can assume that a partial upgrade
 	// has been performed and can skip the next steps.
-	poolID := int64(-1)
+	var poolID int64
 	pools, err := d.cluster.StoragePools()
 	if err == nil { // Already exist valid storage pools.
 		// Check if the storage pool already has a db entry.
@@ -1594,7 +1594,7 @@ func upgradeFromStorageTypeZfs(name string, d *Daemon, defaultPoolName string, d
 	// Peek into the storage pool database to see whether any storage pools
 	// are already configured. If so, we can assume that a partial upgrade
 	// has been performed and can skip the next steps.
-	poolID := int64(-1)
+	var poolID int64
 	pools, err := d.cluster.StoragePools()
 	if err == nil { // Already exist valid storage pools.
 		// Check if the storage pool already has a db entry.
diff --git a/lxd/proxy_device_utils.go b/lxd/proxy_device_utils.go
index 2d84f9a269..b4b2ba16dd 100644
--- a/lxd/proxy_device_utils.go
+++ b/lxd/proxy_device_utils.go
@@ -55,8 +55,8 @@ func setupProxyProcInfo(c container, device map[string]string) (*proxyProcInfo,
 		return nil, fmt.Errorf("Proxy device doesn't support the listener type: %s", proto)
 	}
 
-	listenPid := "-1"
-	connectPid := "-1"
+	var listenPid string
+	var connectPid string
 
 	bindVal, exists := device["bind"]
 	if !exists {


More information about the lxc-devel mailing list