[lxc-devel] [lxd/master] shared: Fix HostPathFollow for stdin/stdout
stgraber on Github
lxc-bot at linuxcontainers.org
Sun Feb 16 04:05:45 UTC 2020
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/20200215/67c96f96/attachment.bin>
-------------- next part --------------
From 32ce171885f40b2ecfaf1c4449c89ea0f33c9bb3 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?St=C3=A9phane=20Graber?= <stgraber at ubuntu.com>
Date: Sat, 15 Feb 2020 23:05:10 -0500
Subject: [PATCH] shared: Fix HostPathFollow for stdin/stdout
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>
---
shared/util.go | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/shared/util.go b/shared/util.go
index aae5defc6f..ae9da6d281 100644
--- a/shared/util.go
+++ b/shared/util.go
@@ -109,6 +109,16 @@ func IsUnixSocket(path string) bool {
// HostPathFollow takes a valid path (from HostPath) and resolves it
// all the way to its target or to the last which can be resolved.
func HostPathFollow(path string) string {
+ // Ignore empty paths
+ if len(path) == 0 {
+ return path
+ }
+
+ // Don't prefix stdin/stdout
+ if path == "-" {
+ return path
+ }
+
// Check if we're running in a snap package.
_, inSnap := os.LookupEnv("SNAP")
snapName := os.Getenv("SNAP_NAME")
More information about the lxc-devel
mailing list