atom / node-pathwatcher

Path Watcher Node Module
http://atom.github.io/node-pathwatcher
MIT License
93 stars 47 forks source link

Avoid reading garbage when GetOverlappedResult succeeds w/ zero bytes #123

Closed maxbrunsfeld closed 7 years ago

maxbrunsfeld commented 7 years ago

Fixes https://github.com/atom/atom/issues/15223

Apparently, when listening for changes to folders on SMB drives, the GetOverlappedResult API can succeed (return true) but set the numberOfBytesTransferred parameter to zero. Previously, our code was expecting that if GetOverlappedResult returned true, then there would always be at least one FILE_NOTIFY_INFORMATION structure to read.

maxbrunsfeld commented 7 years ago

I would like to get test coverage on this, but I don't know how, and it's a simple enough change that I think it's ok to proceed without it, unless someone can think of a practical way to create a test.

maxbrunsfeld commented 7 years ago

/cc @ungb