[lxc-devel] [lxd/master] Bugfixes

stgraber on Github lxc-bot at linuxcontainers.org
Thu Mar 2 18:06:25 UTC 2017


A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 301 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20170302/3c236624/attachment.bin>
-------------- next part --------------
From e01c1785921883b84391305af64293f405099bb5 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?St=C3=A9phane=20Graber?= <stgraber at ubuntu.com>
Date: Thu, 2 Mar 2017 13:05:49 -0500
Subject: [PATCH] Fix error handling in all filepath.Walk calls
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/container_lxc.go     | 7 ++++++-
 shared/idmapset_linux.go | 6 ++++++
 2 files changed, 12 insertions(+), 1 deletion(-)

diff --git a/lxd/container_lxc.go b/lxd/container_lxc.go
index dd86bd8..c122ecd 100644
--- a/lxd/container_lxc.go
+++ b/lxd/container_lxc.go
@@ -3822,7 +3822,12 @@ func (c *containerLXC) Export(w io.Writer, properties map[string]string) error {
 	offset := len(cDir) + 1
 
 	writeToTar := func(path string, fi os.FileInfo, err error) error {
-		if err := c.tarStoreFile(linkmap, offset, tw, path, fi); err != nil {
+		if err != nil {
+			return err
+		}
+
+		err = c.tarStoreFile(linkmap, offset, tw, path, fi)
+		if err != nil {
 			shared.LogDebugf("Error tarring up %s: %s", path, err)
 			return err
 		}
diff --git a/shared/idmapset_linux.go b/shared/idmapset_linux.go
index d08970e..85e991f 100644
--- a/shared/idmapset_linux.go
+++ b/shared/idmapset_linux.go
@@ -455,10 +455,15 @@ func (set *IdmapSet) doUidshiftIntoContainer(dir string, testmode bool, how stri
 	dir = strings.TrimRight(dir, "/")
 
 	convert := func(path string, fi os.FileInfo, err error) (e error) {
+		if err != nil {
+			return err
+		}
+
 		intUid, intGid, _, _, _, _, err := GetFileStat(path)
 		if err != nil {
 			return err
 		}
+
 		uid := int64(intUid)
 		gid := int64(intGid)
 
@@ -484,6 +489,7 @@ func (set *IdmapSet) doUidshiftIntoContainer(dir string, testmode bool, how stri
 	if !PathExists(dir) {
 		return fmt.Errorf("No such file or directory: %q", dir)
 	}
+
 	return filepath.Walk(dir, convert)
 }
 


More information about the lxc-devel mailing list