[PATCH] Fix an issue where bird may accidently close a socket

Kenth Eriksson kenth.eriksson at infinera.com
Mon May 27 14:28:52 CEST 2019


Datagram sockets may return 0 and stream sockets can return 0
if the requested number of bytes to read is 0.

Signed-off-by: Kenth Eriksson <kenth.eriksson at infinera.com>
---
 sysdep/unix/io.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sysdep/unix/io.c b/sysdep/unix/io.c
index d1d86e3b..44dd3172 100644
--- a/sysdep/unix/io.c
+++ b/sysdep/unix/io.c
@@ -1873,7 +1873,7 @@ sk_read(sock *s, int revents)
 	  s->err_hook(s, 0);
 	}
       }
-      else if (!c)
+      else if (!c && (revents & POLLHUP))
 	s->err_hook(s, 0);
       else
       {
-- 
2.21.0



More information about the Bird-users mailing list