Review please :-)

simo idra at samba.org
Mon Jun 15 14:54:21 GMT 2009


On Sun, 2009-06-14 at 23:00 +0200, Volker Lendecke wrote:
> Hi!
> 
> While converting the winbind children to tevent_loop_once I
> found I need the attached patch.
> 
> tevent gurus, can I put this in? :-)
> 
> Volker
> 
> 
> 
> 
> 
> 
> 
> differences
> between files
> attachment
> (0001-Re-init-the-nesting-level-to-0-in-tevent_common_cont.patch)
> 
> From b469a2291148b0c00ea2b9a546c918edf1cd2a65 Mon Sep 17 00:00:00 2001
> From: Volker Lendecke <vl at samba.org>
> Date: Sun, 14 Jun 2009 22:52:31 +0200
> Subject: [PATCH] Re-init the nesting level to 0 in
> tevent_common_context_destructor
> 
> This is required for the s3 winbind: Here we fork a child from within
> an event
> handler. In the child we call tevent_common_context_destructor() on
> the
> existing event context. This deletes *all* pending requests, so we
> start as if
> we had a new event context. We never return to our parent from the
> then nested
> event loop in the child process.
> 
> Volker
> ---
>  lib/tevent/tevent.c |    2 ++
>  1 files changed, 2 insertions(+), 0 deletions(-)
> 
> diff --git a/lib/tevent/tevent.c b/lib/tevent/tevent.c
> index 0c02e46..6e531ed 100644
> --- a/lib/tevent/tevent.c
> +++ b/lib/tevent/tevent.c
> @@ -176,6 +176,8 @@ int tevent_common_context_destructor(struct
> tevent_context *ev)
>                 DLIST_REMOVE(ev->signal_events, se);
>         }
>  
> +       ev->nesting.level = 0;
> +
>         return 0;
>  }


Volker,
if I am not wrong tevent_common_context_destructor() is the ev
destructor. Once the talloc_free() that cause this destructor to run
returns the ev will not exists anymore.
So I am not sure why should we care zeroing one of the structures
variables ?

Or is there something I am missing here ?

Simo.

-- 
Simo Sorce
Samba Team GPL Compliance Officer <simo at samba.org>
Principal Software Engineer at Red Hat, Inc. <simo at redhat.com>



More information about the samba-technical mailing list