[Spread-cvs] commit: r367 - in trunk: daemon libspread
jonathan at spread.org
jonathan at spread.org
Wed Nov 15 10:30:32 EST 2006
Author: jonathan
Date: 2006-11-15 10:30:32 -0500 (Wed, 15 Nov 2006)
New Revision: 367
Modified:
trunk/daemon/Changelog
trunk/libspread/sp.c
Log:
Always initialize wait_time and sel_time on connect_nointr_timeout even if connect call is blocking.
This prevents use of sel_time without being initialized.
Modified: trunk/daemon/Changelog
===================================================================
--- trunk/daemon/Changelog 2006-11-15 15:29:19 UTC (rev 366)
+++ trunk/daemon/Changelog 2006-11-15 15:30:32 UTC (rev 367)
@@ -1,3 +1,8 @@
+Wed Nov 15 10:27:33 2006 Jonathan Stanton <jonathan at cnds.jhu.edu>
+
+ * sp.c (connect_nointr_timeout): Move wait_timeout
+ initialization up so it always happens, even for blocking.
+
Tue Nov 14 03:40:43 2006 Jonathan Stanton <jonathan at cnds.jhu.edu>
* arch.h, groups.c, memory.h: Make memory.h inline function
Modified: trunk/libspread/sp.c
===================================================================
--- trunk/libspread/sp.c 2006-11-15 15:29:19 UTC (rev 366)
+++ trunk/libspread/sp.c 2006-11-15 15:30:32 UTC (rev 367)
@@ -332,15 +332,17 @@
int ret_ioctl;
sockopt_len_t elen;
+ /* initialize time values even if blocking so later use is valid */
+ start_time = E_get_time();
+ target_time = E_add_time(start_time, *time_out);
+ wait_time = *time_out;
+ sel_time.tv_sec = wait_time.sec;
+ sel_time.tv_usec = wait_time.usec;
+
if ( E_compare_time(Zero_timeout, *time_out) < 0 )
{
+ /* set file descriptor to non-blocking */
non_blocking = 1;
- start_time = E_get_time();
- target_time = E_add_time(start_time, *time_out);
- wait_time = *time_out;
- sel_time.tv_sec = wait_time.sec;
- sel_time.tv_usec = wait_time.usec;
- /* set file descriptor to non-blocking */
on = 1;
ret_ioctl = ioctl( s, FIONBIO, &on);
}
More information about the Spread-cvs
mailing list