From: Peter Armitage Date: Tue, 16 Dec 2014 14:12:48 +0000 (+0000) Subject: syscall: fs_nacl: Unlock() should be deferred. X-Git-Tag: go1.5beta1~2567 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=47c7cf435705860dc143e8741616b8d6157de671;p=gostls13.git syscall: fs_nacl: Unlock() should be deferred. Change-Id: Iea08b8f4e74a8cd4b4d317273046457c8db956a1 Reviewed-on: https://go-review.googlesource.com/1640 Reviewed-by: Minux Ma Reviewed-by: Russ Cox --- diff --git a/src/syscall/fs_nacl.go b/src/syscall/fs_nacl.go index 6e6ce2ab7b..f52897edc3 100644 --- a/src/syscall/fs_nacl.go +++ b/src/syscall/fs_nacl.go @@ -815,7 +815,7 @@ func fdToFsysFile(fd int) (*fsysFile, error) { // It is meant to be called when initializing the file system image. func create(name string, mode uint32, sec int64, data []byte) error { fs.mu.Lock() - fs.mu.Unlock() + defer fs.mu.Unlock() f, err := fs.open(name, O_CREATE|O_EXCL, mode) if err != nil { if mode&S_IFMT == S_IFDIR {