Socket timeout bug (?).

Sergei Organov osv at javad.ru
Mon Sep 16 08:01:35 UTC 2002


"Joel Sherrill <joel at OARcorp.com>" <joel.sherrill at OARcorp.com> writes:
[...]
> I did a search for similar code in the stack and only came up
> with rtems/rtems_select.c (select()) which already had a similar
> piece of code.  It could be doing the same thing a different way
> though.  Anyway, I am committing this which I believe fixes this
> one:
> 
> Index: kern/uipc_socket.c
> ===================================================================
> RCS file: /usr1/CVS/rtems/cpukit/libnetworking/kern/uipc_socket.c,v
> retrieving revision 1.4
> diff -u -r1.4 uipc_socket.c
> --- kern/uipc_socket.c	11 Jun 1999 14:11:41 -0000	1.4
> +++ kern/uipc_socket.c	14 Sep 2002 18:27:39 -0000
> @@ -961,6 +961,8 @@
>  				goto bad;
>  			}
>  			val = tv->tv_sec * hz + tv->tv_usec / tick;
> +			if (val == 0)
> +				val = 1;

I worry if the case when timeout is set to exact 0 goes through this path? If
so, the patch wold break "wait forever" behavior of timeout 0.


BR,
Sergei.





More information about the users mailing list