This patch modifies util_sock.c/set_socket_options to pass timeval argument instead of integer to setsockopt which is necessary to make it work under linux, at least the 2.4 kernel.
--
Jindrich Makovicka
--- util_sock.c.orig Fri May 3 03:03:12 2002 +++ util_sock.c Fri Aug 2 22:02:42 2002 @@ -47,7 +47,7 @@ return(getsockopt(fd, SOL_SOCKET, SO_TYPE, (char *)&v, &l) == 0); } -enum SOCK_OPT_TYPES {OPT_BOOL,OPT_INT,OPT_ON}; +enum SOCK_OPT_TYPES {OPT_BOOL,OPT_INT,OPT_ON,OPT_TIMEVAL}; typedef struct smb_socket_option { char *name; @@ -86,10 +86,10 @@ {"SO_RCVLOWAT", SOL_SOCKET, SO_RCVLOWAT, 0, OPT_INT}, #endif #ifdef SO_SNDTIMEO - {"SO_SNDTIMEO", SOL_SOCKET, SO_SNDTIMEO, 0, OPT_INT}, + {"SO_SNDTIMEO", SOL_SOCKET, SO_SNDTIMEO, 0, +OPT_TIMEVAL}, #endif #ifdef SO_RCVTIMEO - {"SO_RCVTIMEO", SOL_SOCKET, SO_RCVTIMEO, 0, OPT_INT}, + {"SO_RCVTIMEO", SOL_SOCKET, SO_RCVTIMEO, 0, +OPT_TIMEVAL}, #endif {NULL,0,0,0,0}}; @@ -117,6 +117,7 @@ void set_socket_options(int fd, char *options) { + struct timeval tv; fstring tok; while (next_token(&options,tok," \t,", sizeof(tok))) { @@ -145,6 +146,12 @@ case OPT_INT: ret = setsockopt(fd,socket_options[i].level, socket_options[i].option,(char *)&value,sizeof(int)); + break; + case OPT_TIMEVAL: + tv.tv_sec = value; + tv.tv_usec = 0; + ret = setsockopt(fd,socket_options[i].level, + +socket_options[i].option,&tv,sizeof(tv)); break; case OPT_ON: