From 480c705e96fc25cf3933c831e7fbc5ac297d307f Mon Sep 17 00:00:00 2001 From: Con Kolivas Date: Wed, 19 Nov 2014 21:22:31 +1100 Subject: [PATCH] Handle invalidated socket fds with an error in the wait read/write select functions --- src/libckpool.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/libckpool.c b/src/libckpool.c index 8fb55173..747ac02d 100644 --- a/src/libckpool.c +++ b/src/libckpool.c @@ -711,6 +711,8 @@ int wait_read_select(int sockd, int timeout) { struct pollfd sfd; + if (unlikely(sockd < 0)) + return -1; sfd.fd = sockd; sfd.events = POLLIN; sfd.revents = 0; @@ -784,6 +786,8 @@ int wait_write_select(int sockd, int timeout) { struct pollfd sfd; + if (unlikely(sockd < 0)) + return -1; sfd.fd = sockd; sfd.events = POLLOUT; sfd.revents = 0;