From bb34ecc1ce527b800c3defd49cf3b49d1fe69580 Mon Sep 17 00:00:00 2001 From: Fabian Keil Date: Sun, 27 Mar 2011 14:02:53 +0000 Subject: [PATCH] Zero out the timeval struct in rfc2553_connect_to() completely and rename it to timeout It's not used for anything else so there's not need for a generic name. While at it, use a struct instead of an array of a single struct. --- jbsockets.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/jbsockets.c b/jbsockets.c index a75641dc..c4584e2e 100644 --- a/jbsockets.c +++ b/jbsockets.c @@ -1,4 +1,4 @@ -const char jbsockets_rcs[] = "$Id: jbsockets.c,v 1.92 2011/03/27 13:57:41 fabiankeil Exp $"; +const char jbsockets_rcs[] = "$Id: jbsockets.c,v 1.93 2011/03/27 13:58:33 fabiankeil Exp $"; /********************************************************************* * * File : $Source: /cvsroot/ijbswa/current/jbsockets.c,v $ @@ -175,7 +175,7 @@ static jb_socket rfc2553_connect_to(const char *host, int portnum, struct client int retval; jb_socket fd; fd_set wfds; - struct timeval tv[1]; + struct timeval timeout; #if !defined(_WIN32) && !defined(__BEOS__) && !defined(AMIGA) && !defined(__OS2__) int flags; #endif @@ -319,11 +319,11 @@ static jb_socket rfc2553_connect_to(const char *host, int portnum, struct client FD_ZERO(&wfds); FD_SET(fd, &wfds); - tv->tv_sec = 30; - tv->tv_usec = 0; + memset(&timeout, 0, sizeof(timeout)); + timeout.tv_sec = 30; /* MS Windows uses int, not SOCKET, for the 1st arg of select(). Wierd! */ - if ((select((int)fd + 1, NULL, &wfds, NULL, tv) > 0) + if ((select((int)fd + 1, NULL, &wfds, NULL, &timeout) > 0) && FD_ISSET(fd, &wfds)) { socklen_t optlen = sizeof(socket_error); -- 2.39.2