summaryrefslogtreecommitdiff
path: root/src/syscall
diff options
context:
space:
mode:
authorRuss Cox <rsc@golang.org>2014-10-27 20:45:16 -0400
committerRuss Cox <rsc@golang.org>2014-10-27 20:45:16 -0400
commit89a71934ad700582a3d6937bb936e2cb3c6704c8 (patch)
treebe23ffe341b89e9f93b65da8991ed8e46ee5a91c /src/syscall
parentc76e3ec3a072c5c1a89952beeedc12b596d9d08d (diff)
downloadgo-89a71934ad700582a3d6937bb936e2cb3c6704c8.tar.gz
syscall: accept pre-existing directories in nacl zip file
NaCl creates /tmp. This lets the zip file populate it. LGTM=adg R=adg CC=golang-codereviews https://codereview.appspot.com/159600043
Diffstat (limited to 'src/syscall')
-rw-r--r--src/syscall/fs_nacl.go6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/syscall/fs_nacl.go b/src/syscall/fs_nacl.go
index 4abc9b81c..6e6ce2ab7 100644
--- a/src/syscall/fs_nacl.go
+++ b/src/syscall/fs_nacl.go
@@ -818,6 +818,12 @@ func create(name string, mode uint32, sec int64, data []byte) error {
fs.mu.Unlock()
f, err := fs.open(name, O_CREATE|O_EXCL, mode)
if err != nil {
+ if mode&S_IFMT == S_IFDIR {
+ ip, _, err := fs.namei(name, false)
+ if err == nil && (ip.Mode&S_IFMT) == S_IFDIR {
+ return nil // directory already exists
+ }
+ }
return err
}
ip := f.(*fsysFile).inode