From 4112fb9cd77a6eb2738f97287f99a23809d5c85d Mon Sep 17 00:00:00 2001 From: Matthew Ellison Date: Mon, 22 May 2017 12:00:06 -0400 Subject: [PATCH] darwin: Adds Check Empty Writes to TUN --- syscalls_darwin.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/syscalls_darwin.go b/syscalls_darwin.go index 3bdbc50..6a473f8 100644 --- a/syscalls_darwin.go +++ b/syscalls_darwin.go @@ -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()