fix tevent select style?

Jeremy Allison jra at samba.org
Wed Oct 6 12:05:12 MDT 2010


On Wed, Oct 06, 2010 at 06:51:03PM +0200, Volker Lendecke wrote:
> Hi!
> 
> Comments for the attached patch?
> 
> Volker

> >From 873317a7f2517d2e687a913e0400b502b70473d9 Mon Sep 17 00:00:00 2001
> From: Volker Lendecke <vl at samba.org>
> Date: Wed, 6 Oct 2010 18:47:08 +0200
> Subject: [PATCH] tevent: Only call handlers that ask for events
> 
> The s3 libsmbclient puts two different handlers on a single fd for readability
> and writability. With select this works fine, however without this patch we
> uncontionally call the write handler even if the socket is only readable. We
> should have called the read handler instead.
> ---
>  lib/tevent/tevent_standard.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/lib/tevent/tevent_standard.c b/lib/tevent/tevent_standard.c
> index 1c8ed0e..a68a03c 100644
> --- a/lib/tevent/tevent_standard.c
> +++ b/lib/tevent/tevent_standard.c
> @@ -505,7 +505,7 @@ static int std_event_loop_select(struct std_event_context *std_ev, struct timeva
>  
>  			if (FD_ISSET(fde->fd, &r_fds)) flags |= TEVENT_FD_READ;
>  			if (FD_ISSET(fde->fd, &w_fds)) flags |= TEVENT_FD_WRITE;
> -			if (flags) {
> +			if (flags & fde->flags) {
>  				fde->handler(std_ev->ev, fde, flags, fde->private_data);
>  				break;
>  			}
> -- 
> 1.7.0.4
> 

Ooooh. That's a really nice, subtle fix ! Well caught.

Only fix is change "uncontionally" -> "unconditionally" :-).

Please push !

Jeremy.


More information about the samba-technical mailing list