From 89a71934ad700582a3d6937bb936e2cb3c6704c8 Mon Sep 17 00:00:00 2001 From: Russ Cox Date: Mon, 27 Oct 2014 20:45:16 -0400 Subject: 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 --- src/syscall/fs_nacl.go | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/syscall') 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 -- cgit v1.2.1