aboutsummaryrefslogtreecommitdiff
path: root/src/syscall
diff options
context:
space:
mode:
authorBrad Fitzpatrick <bradfitz@golang.org>2018-04-11 22:51:17 +0000
committerBrad Fitzpatrick <bradfitz@golang.org>2018-04-11 23:06:44 +0000
commit044d2d5af62001665cc28ce78757fc2831e78eeb (patch)
tree18e3e7b3879d3427e211e9a214edef518fa1758f /src/syscall
parenta44cd6866380c90870ee92a3b053f780a900b282 (diff)
downloadgo-044d2d5af62001665cc28ce78757fc2831e78eeb.tar.xz
os: document that Chown with -1 means to leave values unchanged, like POSIX
And fix the nacl implementation. Fixes #24710 Change-Id: I31ffeea03a72dac5021ffb183fde31e9ffd060ad Reviewed-on: https://go-review.googlesource.com/106464 Reviewed-by: Ian Lance Taylor <iant@golang.org> Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
Diffstat (limited to 'src/syscall')
-rw-r--r--src/syscall/fs_nacl.go8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/syscall/fs_nacl.go b/src/syscall/fs_nacl.go
index 33334dc24b..dfe13d92a1 100644
--- a/src/syscall/fs_nacl.go
+++ b/src/syscall/fs_nacl.go
@@ -582,8 +582,12 @@ func Chown(path string, uid, gid int) error {
if err != nil {
return err
}
- ip.Uid = uint32(uid)
- ip.Gid = uint32(gid)
+ if uid != -1 {
+ ip.Uid = uint32(uid)
+ }
+ if gid != -1 {
+ ip.Gid = uint32(gid)
+ }
return nil
}