From 7d97ead8aafc134799052485ca8190afe3e9992f Mon Sep 17 00:00:00 2001 From: Con Kolivas Date: Mon, 28 Apr 2014 22:16:04 +1000 Subject: [PATCH] Return the correct failure type in recv_unix_msg --- src/libckpool.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/libckpool.c b/src/libckpool.c index 31df220e..267137be 100644 --- a/src/libckpool.c +++ b/src/libckpool.c @@ -698,7 +698,7 @@ out: /* Use a standard message across the unix sockets: * 4 byte length of message as little endian encoded uint32_t followed by the - * string.*/ + * string. Return NULL in case of failure. */ char *recv_unix_msg(int sockd) { tv_t tv_timeout = {60, 0}; @@ -712,7 +712,7 @@ char *recv_unix_msg(int sockd) ret = select(sockd + 1, &readfs, NULL, NULL, &tv_timeout); if (ret < 1) { LOGERR("Select1 failed in recv_unix_msg"); - return false; + goto out; } /* Get message length */ ret = read(sockd, &msglen, 4); @@ -737,12 +737,13 @@ char *recv_unix_msg(int sockd) ret = select(sockd + 1, &readfs, NULL, NULL, &tv_timeout); if (ret < 1) { LOGERR("Select2 failed in recv_unix_msg"); - return false; + dealloc(buf); + goto out; } ret = read(sockd, buf + ofs, msglen); if (unlikely(ret < 0)) { LOGERR("Failed to read %d bytes in recv_unix_msg", msglen); - ret = 1; + dealloc(buf); goto out; } ofs += ret;