[svn r265] Fixed some bugs related with type sizes of primitive types of standard C library (time_t is long int). trunk
authorrosfran
Thu Jan 11 19:00:15 2007 +0000 (2007-01-11)
branchtrunk
changeset 2646d84a80de234
parent 263 8522636169df
child 265 c7050cb68338
[svn r265] Fixed some bugs related with type sizes of primitive types of standard C library (time_t is long int).
gmyth/src/gmyth_socket.c
     1.1 --- a/gmyth/src/gmyth_socket.c	Thu Jan 11 18:23:41 2007 +0000
     1.2 +++ b/gmyth/src/gmyth_socket.c	Thu Jan 11 19:00:15 2007 +0000
     1.3 @@ -432,7 +432,7 @@
     1.4  gmyth_socket_try_connect ( gint fd, struct sockaddr *remote, gint len,
     1.5                 struct timeval *timeout, gint *err)
     1.6  {
     1.7 -	  g_return_val_if_fail( timeout != NULL, 0 );
     1.8 +	  /*g_return_val_if_fail( timeout != NULL, 0 );*/	  
     1.9  	  gint saveflags, ret, back_err;
    1.10  	  
    1.11  	  fd_set fd_w;
    1.12 @@ -473,7 +473,7 @@
    1.13  	  FD_ZERO( &fd_w );
    1.14  	  FD_SET( fd, &fd_w );
    1.15  	
    1.16 -	  printf ("xxxxxxxxxxxx %d\n", timeout->tv_sec);
    1.17 +	  printf ("xxxxxxxxxxxx %ld\n", timeout->tv_sec);
    1.18  	  *err = select( FD_SETSIZE, NULL, &fd_w, NULL, timeout);
    1.19  	  if ( *err < 0 ) {
    1.20  	    g_warning( "[%s] Connection unsucessfull (timed out).\n", __FUNCTION__ );
    1.21 @@ -560,13 +560,17 @@
    1.22          if ( gmyth_socket->sd < 0 )
    1.23              continue;
    1.24  
    1.25 -        struct timeval *timeout_val = NULL;
    1.26 +        struct timeval *timeout_val = g_new0 (struct timeval, 1);
    1.27  	if (timeout != 0) {
    1.28 -	    timeout_val = g_new0 (struct timeval, 1);
    1.29 +	    /*timeout_val = g_new0 (struct timeval, 1);*/
    1.30  	    
    1.31              timeout_val->tv_sec = timeout;
    1.32 -	    printf ("XXXXXXXXXXX setting timeout %d\n", timeout_val->tv_sec);
    1.33 +	    printf ("XXXXXXXXXXX setting timeout %ld\n", timeout_val->tv_sec);
    1.34              timeout_val->tv_usec = 0;
    1.35 +	} else {
    1.36 +      timeout_val->tv_sec = 0;
    1.37 +	    printf ("XXXXXXXXXXX timeout is ZERO. Setting timeout to the default value of 100 microseconds -> %ld\n", timeout_val->tv_sec);
    1.38 +      timeout_val->tv_usec = 100;
    1.39  	}
    1.40          
    1.41          if (gmyth_socket_try_connect (gmyth_socket->sd, (struct sockaddr *)addr_info0->ai_addr,