[lxc-devel] [lxd/master] shared: Derefence directory symlinks

monstermunchkin on Github lxc-bot at linuxcontainers.org
Tue Jun 26 14:10:05 UTC 2018


A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 470 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20180626/46236431/attachment.bin>
-------------- next part --------------
From b271c265be94842ecbaed85fea23f9c984be4496 Mon Sep 17 00:00:00 2001
From: Thomas Hipp <thomas.hipp at canonical.com>
Date: Tue, 26 Jun 2018 16:07:24 +0200
Subject: [PATCH] shared: Derefence directory symlinks

This change prevents failure when adding disk devices to containers
where the source is a symlinked directory.

Signed-off-by: Thomas Hipp <thomas.hipp at canonical.com>
---
 shared/util.go | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/shared/util.go b/shared/util.go
index 8b264081a..6d4ea1867 100644
--- a/shared/util.go
+++ b/shared/util.go
@@ -89,7 +89,7 @@ func PathIsEmpty(path string) (bool, error) {
 
 // IsDir returns true if the given path is a directory.
 func IsDir(name string) bool {
-	stat, err := os.Lstat(name)
+	stat, err := os.Stat(name)
 	if err != nil {
 		return false
 	}


More information about the lxc-devel mailing list