# HG changeset patch # User rosfran # Date 1168542015 0 # Node ID 6d84a80de234329ba6242f4c8b1e0f877b5522aa # Parent 8522636169df594cedf54f57c12655523530cf85 [svn r265] Fixed some bugs related with type sizes of primitive types of standard C library (time_t is long int). diff -r 8522636169df -r 6d84a80de234 gmyth/src/gmyth_socket.c --- a/gmyth/src/gmyth_socket.c Thu Jan 11 18:23:41 2007 +0000 +++ b/gmyth/src/gmyth_socket.c Thu Jan 11 19:00:15 2007 +0000 @@ -432,7 +432,7 @@ gmyth_socket_try_connect ( gint fd, struct sockaddr *remote, gint len, struct timeval *timeout, gint *err) { - g_return_val_if_fail( timeout != NULL, 0 ); + /*g_return_val_if_fail( timeout != NULL, 0 );*/ gint saveflags, ret, back_err; fd_set fd_w; @@ -473,7 +473,7 @@ FD_ZERO( &fd_w ); FD_SET( fd, &fd_w ); - printf ("xxxxxxxxxxxx %d\n", timeout->tv_sec); + printf ("xxxxxxxxxxxx %ld\n", timeout->tv_sec); *err = select( FD_SETSIZE, NULL, &fd_w, NULL, timeout); if ( *err < 0 ) { g_warning( "[%s] Connection unsucessfull (timed out).\n", __FUNCTION__ ); @@ -560,13 +560,17 @@ if ( gmyth_socket->sd < 0 ) continue; - struct timeval *timeout_val = NULL; + struct timeval *timeout_val = g_new0 (struct timeval, 1); if (timeout != 0) { - timeout_val = g_new0 (struct timeval, 1); + /*timeout_val = g_new0 (struct timeval, 1);*/ timeout_val->tv_sec = timeout; - printf ("XXXXXXXXXXX setting timeout %d\n", timeout_val->tv_sec); + printf ("XXXXXXXXXXX setting timeout %ld\n", timeout_val->tv_sec); timeout_val->tv_usec = 0; + } else { + timeout_val->tv_sec = 0; + printf ("XXXXXXXXXXX timeout is ZERO. Setting timeout to the default value of 100 microseconds -> %ld\n", timeout_val->tv_sec); + timeout_val->tv_usec = 100; } if (gmyth_socket_try_connect (gmyth_socket->sd, (struct sockaddr *)addr_info0->ai_addr,