From: Tim Wright Date: Wed, 22 Nov 2017 03:11:56 +0000 (-0800) Subject: syscall: add missing fs locking in Link, Rename on nacl X-Git-Tag: go1.10beta1~170 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=a2a1c173d7917e86e2f0a3323676ae29f188593c;p=gostls13.git syscall: add missing fs locking in Link, Rename on nacl Per the comments at the head of fs_nacl.go, unexported methods expect the fs mutex to have been taken by the caller. This change brings Link and Rename into line with the other exported functions wrt fs locking. Fixes #22690 Change-Id: I46d08f7d227f23ff49bb0099d218214364a45e1a Reviewed-on: https://go-review.googlesource.com/79295 Reviewed-by: Brad Fitzpatrick Run-TryBot: Brad Fitzpatrick TryBot-Result: Gobot Gobot --- diff --git a/src/syscall/fs_nacl.go b/src/syscall/fs_nacl.go index 8fee4daee9..33334dc24b 100644 --- a/src/syscall/fs_nacl.go +++ b/src/syscall/fs_nacl.go @@ -625,6 +625,8 @@ func UtimesNano(path string, ts []Timespec) error { func Link(path, link string) error { fsinit() + fs.mu.Lock() + defer fs.mu.Unlock() ip, _, err := fs.namei(path, false) if err != nil { return err @@ -646,6 +648,8 @@ func Link(path, link string) error { func Rename(from, to string) error { fsinit() + fs.mu.Lock() + defer fs.mu.Unlock() fdp, felem, err := fs.namei(from, true) if err != nil { return err