[SCM] Samba Shared Repository - branch master updated

Stefan Metzmacher metze at samba.org
Thu Feb 9 04:25:04 MST 2012


The branch, master has been updated
       via  de53fcd tevent: change the version to 0.9.15
       via  b5436fd tevent: Fix deleting signal events from within themselves
      from  4328f3c smbwrapper: Remove smbwrapper

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit de53fcd8de5b751efb97adb43663a73059dc8ed3
Author: Stefan Metzmacher <metze at samba.org>
Date:   Thu Feb 9 10:11:19 2012 +0100

    tevent: change the version to 0.9.15
    
    metze
    
    Autobuild-User: Stefan Metzmacher <metze at samba.org>
    Autobuild-Date: Thu Feb  9 12:24:19 CET 2012 on sn-devel-104

commit b5436fde5bbe5b849212258088add492ee8fc4ce
Author: Volker Lendecke <vl at samba.org>
Date:   Sat Jan 28 22:18:00 2012 +0100

    tevent: Fix deleting signal events from within themselves
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>

-----------------------------------------------------------------------

Summary of changes:
 .../ABI/{tevent-0.9.14.sigs => tevent-0.9.15.sigs} |    0
 lib/tevent/tevent_signal.c                         |   35 ++++++++++++++++++-
 lib/tevent/wscript                                 |    2 +-
 3 files changed, 34 insertions(+), 3 deletions(-)
 copy lib/tevent/ABI/{tevent-0.9.14.sigs => tevent-0.9.15.sigs} (100%)


Changeset truncated at 500 lines:

diff --git a/lib/tevent/ABI/tevent-0.9.14.sigs b/lib/tevent/ABI/tevent-0.9.15.sigs
similarity index 100%
copy from lib/tevent/ABI/tevent-0.9.14.sigs
copy to lib/tevent/ABI/tevent-0.9.15.sigs
diff --git a/lib/tevent/tevent_signal.c b/lib/tevent/tevent_signal.c
index fabe72c..248dd35 100644
--- a/lib/tevent/tevent_signal.c
+++ b/lib/tevent/tevent_signal.c
@@ -307,6 +307,15 @@ struct tevent_signal *tevent_common_add_signal(struct tevent_context *ev,
 	return se;
 }
 
+struct tevent_se_exists {
+	struct tevent_se_exists **myself;
+};
+
+static int tevent_se_exists_destructor(struct tevent_se_exists *s)
+{
+	*s->myself = NULL;
+	return 0;
+}
 
 /*
   check if a signal is pending
@@ -335,6 +344,23 @@ int tevent_common_check_signal(struct tevent_context *ev)
 		}
 		for (sl=sig_state->sig_handlers[i];sl;sl=next) {
 			struct tevent_signal *se = sl->se;
+			struct tevent_se_exists *exists;
+
+			/*
+			 * We have to be careful to not touch "se"
+			 * after it was deleted in its handler. Thus
+			 * we allocate a child whose destructor will
+			 * tell by nulling out itself that its parent
+			 * is gone.
+			 */
+			exists = talloc(se, struct tevent_se_exists);
+			if (exists == NULL) {
+				continue;
+			}
+			exists->myself = &exists;
+			talloc_set_destructor(
+				exists, tevent_se_exists_destructor);
+
 			next = sl->next;
 #ifdef SA_SIGINFO
 			if (se->sa_flags & SA_SIGINFO) {
@@ -352,21 +378,26 @@ int tevent_common_check_signal(struct tevent_context *ev)
 					se->handler(ev, se, i, 1,
 						    (void*)&sig_state->sig_info[i][ofs], 
 						    se->private_data);
+					if (!exists) {
+						break;
+					}
 				}
 #ifdef SA_RESETHAND
-				if (se->sa_flags & SA_RESETHAND) {
+				if (exists && (se->sa_flags & SA_RESETHAND)) {
 					talloc_free(se);
 				}
 #endif
+				talloc_free(exists);
 				continue;
 			}
 #endif
 			se->handler(ev, se, i, count, NULL, se->private_data);
 #ifdef SA_RESETHAND
-			if (se->sa_flags & SA_RESETHAND) {
+			if (exists && (se->sa_flags & SA_RESETHAND)) {
 				talloc_free(se);
 			}
 #endif
+			talloc_free(exists);
 		}
 
 #ifdef SA_SIGINFO
diff --git a/lib/tevent/wscript b/lib/tevent/wscript
index f98253f..b4bcb71 100644
--- a/lib/tevent/wscript
+++ b/lib/tevent/wscript
@@ -1,7 +1,7 @@
 #!/usr/bin/env python
 
 APPNAME = 'tevent'
-VERSION = '0.9.14'
+VERSION = '0.9.15'
 
 blddir = 'bin'
 


-- 
Samba Shared Repository


More information about the samba-cvs mailing list