]> go.fuhry.dev Git - fsnotify.git/commit
Fix data race on kevent buffer.
authorTilak Sharma <tilaks@google.com>
Tue, 10 Jun 2014 20:09:37 +0000 (13:09 -0700)
committerNathan Youngman <git@nathany.com>
Fri, 13 Jun 2014 02:49:39 +0000 (20:49 -0600)
commite1eb18dccf12cb7098d8e1ed043fcec86c1c65f3
treea42045594bc893ee6a1cafbf494ea04219b64160
parent56a7b52a5ab904422d4ed25871e9d144e746393d
Fix data race on kevent buffer.

In the BSD implementation of fsnotify, the watcher's kbuf buffers a kevent
between syscall.SetKevent (which prepares the kevent) and syscall.Kevent
(which registers the kevent). The implementation intends to protect access to
kbuf, but fails to do so in addWatch and removeWatch.
This change fixes the data race by allocating a new kevent buffer for every
method invocation.
fsnotify_bsd.go