darwin: Adds Check Empty Writes to TUN

This commit is contained in:
Matthew Ellison 2017-05-22 12:00:06 -04:00
parent da7e7e0a3e
commit 4112fb9cd7
No known key found for this signature in database
GPG key ID: A815A44BDC8DD409

View file

@ -151,6 +151,11 @@ func (t *tunReadCloser) Read(to []byte) (int, error) {
}
func (t *tunReadCloser) Write(from []byte) (int, error) {
if len(from) == 0 {
return 0, syscall.EIO
}
t.wMu.Lock()
defer t.wMu.Unlock()