[lxc-devel] [lxd/master] lxc/file: Fix edit in a snap environment

stgraber on Github lxc-bot at linuxcontainers.org
Thu Jan 11 03:16:49 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/20180111/6963a5d1/attachment.bin>
-------------- next part --------------
From 747d70aeee6cf567b4d1d54cf2cf044e1ce6fa47 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?St=C3=A9phane=20Graber?= <stgraber at ubuntu.com>
Date: Wed, 10 Jan 2018 22:16:29 -0500
Subject: [PATCH] lxc/file: Fix edit in a snap environment
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>
---
 lxc/file.go | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lxc/file.go b/lxc/file.go
index 545982d95..d0b5cb127 100644
--- a/lxc/file.go
+++ b/lxc/file.go
@@ -577,7 +577,7 @@ func (c *fileCmd) edit(conf *config.Config, args []string) error {
 	fname := f.Name()
 	f.Close()
 	os.Remove(fname)
-	defer os.Remove(fname)
+	defer os.Remove(shared.HostPath(fname))
 
 	// Extract current value
 	err = c.pull(conf, append([]string{args[0]}, fname))
@@ -585,7 +585,7 @@ func (c *fileCmd) edit(conf *config.Config, args []string) error {
 		return err
 	}
 
-	_, err = shared.TextEditor(fname, []byte{})
+	_, err = shared.TextEditor(shared.HostPath(fname), []byte{})
 	if err != nil {
 		return err
 	}


More information about the lxc-devel mailing list