[lxc-devel] [lxd/master] Fix file push issues
stgraber on Github
lxc-bot at linuxcontainers.org
Fri Apr 8 17:20:28 UTC 2016
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/20160408/a54bd6bd/attachment.bin>
-------------- next part --------------
From 72c0a4c558b4ce72c2e43749dd61d5471791e7a0 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?St=C3=A9phane=20Graber?= <stgraber at ubuntu.com>
Date: Fri, 8 Apr 2016 12:47:38 -0400
Subject: [PATCH 1/2] Fix wrong mode being passed by file push
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, 4 insertions(+)
diff --git a/lxc/file.go b/lxc/file.go
index f16844d..d96bc4c 100644
--- a/lxc/file.go
+++ b/lxc/file.go
@@ -67,6 +67,10 @@ func (c *fileCmd) push(config *lxd.Config, args []string) error {
mode := os.FileMode(0755)
if c.mode != "" {
+ if len(c.mode) == 3 {
+ c.mode = "0" + c.mode
+ }
+
m, err := strconv.ParseInt(c.mode, 0, 0)
if err != nil {
return err
From de6713c741b0869202bb82721d651b90b47048fa Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?St=C3=A9phane=20Graber?= <stgraber at ubuntu.com>
Date: Fri, 8 Apr 2016 13:19:33 -0400
Subject: [PATCH 2/2] Don't let umask mess with modes
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Closes #1872
Signed-off-by: Stéphane Graber <stgraber at ubuntu.com>
---
lxd/nsexec.go | 1 +
1 file changed, 1 insertion(+)
diff --git a/lxd/nsexec.go b/lxd/nsexec.go
index 74073d4..a25c739 100644
--- a/lxd/nsexec.go
+++ b/lxd/nsexec.go
@@ -150,6 +150,7 @@ int manip_file_in_ns(char *rootfs, int pid, char *host, char *container, bool is
}
}
+ umask(0);
container_fd = open(container, container_open_flags, mode);
if (container_fd < 0) {
perror("error: open");
More information about the lxc-devel
mailing list