From 57e3aa83c6fff2fc5ddc89239ac48091c925fd71 Mon Sep 17 00:00:00 2001 From: ckolivas Date: Wed, 22 Apr 2015 14:55:49 +1000 Subject: [PATCH] Differentiate pollin from pollhup in wait_read_select --- src/libckpool.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/libckpool.c b/src/libckpool.c index fee42439..84e8ce8c 100644 --- a/src/libckpool.c +++ b/src/libckpool.c @@ -906,14 +906,19 @@ int wait_close(int sockd, int timeout) int wait_read_select(int sockd, int timeout) { struct pollfd sfd; + int ret = -1; if (unlikely(sockd < 0)) - return -1; + goto out; sfd.fd = sockd; sfd.events = POLLIN; sfd.revents = 0; timeout *= 1000; - return poll(&sfd, 1, timeout); + ret = poll(&sfd, 1, timeout); + if (ret && !(sfd.revents & POLLIN)) + ret = -1; +out: + return ret; } int read_length(int sockd, void *buf, int len)