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

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) ===
The file chmod that go uses calls out to syscall.Fchmod() which is not
implemented for Windows. The os.Chmod() method call out to syscall.Chmod()
which seems to be implemented on all platforms if I read the go sources
correctly.

Closes #3275.

Signed-off-by: Christian Brauner <[email protected]>
From 60eb9ddcb7896e6279f34d07da9055002a5310ec Mon Sep 17 00:00:00 2001
From: Christian Brauner <[email protected]>
Date: Wed, 3 May 2017 15:12:02 +0200
Subject: [PATCH] tree-wide: replace file Chmod() with os.Chmod()

The file chmod that go uses calls out to syscall.Fchmod() which is not
implemented for Windows. The os.Chmod() method call out to syscall.Chmod()
which seems to be implemented on all platforms if I read the go sources
correctly.

Closes #3275.

Signed-off-by: Christian Brauner <[email protected]>
---
 client.go      | 2 +-
 lxc/file.go    | 2 +-
 shared/util.go | 3 ++-
 3 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/client.go b/client.go
index 6a28d06..c665294 100644
--- a/client.go
+++ b/client.go
@@ -1974,7 +1974,7 @@ func (c *Client) RecursivePullFile(container string, p 
string, targetDir string)
                }
                defer f.Close()
 
-               err = f.Chmod(os.FileMode(mode))
+               err = os.Chmod(target, os.FileMode(mode))
                if err != nil {
                        return err
                }
diff --git a/lxc/file.go b/lxc/file.go
index 679c00e..67ecbaf 100644
--- a/lxc/file.go
+++ b/lxc/file.go
@@ -331,7 +331,7 @@ func (c *fileCmd) pull(config *lxd.Config, args []string) 
error {
                        }
                        defer f.Close()
 
-                       err = f.Chmod(os.FileMode(mode))
+                       err = os.Chmod(targetPath, os.FileMode(mode))
                        if err != nil {
                                return err
                        }
diff --git a/shared/util.go b/shared/util.go
index ff6a576..43cba25 100644
--- a/shared/util.go
+++ b/shared/util.go
@@ -561,7 +561,8 @@ func TextEditor(inPath string, inContent []byte) ([]byte, 
error) {
                        return []byte{}, err
                }
 
-               if err = f.Chmod(0600); err != nil {
+               err = os.Chmod(f.Name(), 0600)
+               if err != nil {
                        f.Close()
                        os.Remove(f.Name())
                        return []byte{}, err
_______________________________________________
lxc-devel mailing list
[email protected]
http://lists.linuxcontainers.org/listinfo/lxc-devel

Reply via email to