From fca66b9e8baf760c8bec306f31162b510b04f572 Mon Sep 17 00:00:00 2001 From: Aaron Bedra Date: Thu, 14 Mar 2013 21:34:21 -0500 Subject: Set error when invalid timeout value is given to redisConnectWithTimeout Closes #154 This commit properly sets the error value inside of redisContextWaitReady when an invalid sec or usec value is provided. Tests for each case are provided to demonstrate that the issue is properly fixed and to avoid regression. Signed-off-by: Aaron Bedra --- net.c | 1 + 1 file changed, 1 insertion(+) (limited to 'net.c') diff --git a/net.c b/net.c index 82ab2b4..a495715 100644 --- a/net.c +++ b/net.c @@ -136,6 +136,7 @@ static int redisContextWaitReady(redisContext *c, int fd, const struct timeval * /* Only use timeout when not NULL. */ if (timeout != NULL) { if (timeout->tv_usec > 1000000 || timeout->tv_sec > __MAX_MSEC) { + __redisSetErrorFromErrno(c, REDIS_ERR_IO, NULL); close(fd); return REDIS_ERR; } -- cgit v1.2.3