The following pull request was submitted through Github.
It can be accessed and reviewed at: https://github.com/lxc/lxd/pull/2848

This e-mail was sent by the LXC bot, direct replies will not reach the author
unless they happen to be subscribed to this list.

=== Description (from pull-request) ===
Signed-off-by: Tycho Andersen <tycho.ander...@canonical.com>
From ae99416627cbb08805859f33f6133f9335c0eee9 Mon Sep 17 00:00:00 2001
From: Tycho Andersen <tycho.ander...@canonical.com>
Date: Sat, 4 Feb 2017 13:13:26 +0100
Subject: [PATCH] shared: FileCopy should keep the same mode

Signed-off-by: Tycho Andersen <tycho.ander...@canonical.com>
---
 shared/util.go | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/shared/util.go b/shared/util.go
index 21c2b29..e563dcb 100644
--- a/shared/util.go
+++ b/shared/util.go
@@ -275,10 +275,15 @@ func FileCopy(source string, dest string) error {
        }
        defer s.Close()
 
+       fi, err := s.Stat()
+       if err != nil {
+               return err
+       }
+
        d, err := os.Create(dest)
        if err != nil {
                if os.IsExist(err) {
-                       d, err = os.OpenFile(dest, os.O_WRONLY, 0700)
+                       d, err = os.OpenFile(dest, os.O_WRONLY, fi.Mode())
                        if err != nil {
                                return err
                        }
_______________________________________________
lxc-devel mailing list
lxc-devel@lists.linuxcontainers.org
http://lists.linuxcontainers.org/listinfo/lxc-devel

Reply via email to