From ab03b452098a8da3fd03b656f77afe81c7a12416 Mon Sep 17 00:00:00 2001 From: Stephen Gallagher Date: Wed, 26 Aug 2009 17:52:26 -0400 Subject: [PATCH] Fix for starting SSSD on Ubuntu Change the toggle function to remove and add file descriptor watches instead of toggling the watch state on an existing event --- server/sbus/sssd_dbus_common.c | 40 ++++------------------------------------ 1 files changed, 4 insertions(+), 36 deletions(-) diff --git a/server/sbus/sssd_dbus_common.c b/server/sbus/sssd_dbus_common.c index 76cb3c2..c405ec8 100644 --- a/server/sbus/sssd_dbus_common.c +++ b/server/sbus/sssd_dbus_common.c @@ -118,44 +118,12 @@ dbus_bool_t sbus_add_watch(DBusWatch *dbus_watch, void *data) */ void sbus_toggle_watch(DBusWatch *dbus_watch, void *data) { - struct sbus_watch_ctx *watch; - uint16_t event_flags = 0; - unsigned int flags; - void *watch_data; - - watch_data = dbus_watch_get_data(dbus_watch); - watch = talloc_get_type(watch_data, struct sbus_watch_ctx); - if (!watch) { - DEBUG(0, ("Watch does not carry watch context?!\n")); - /* TODO: abort ? */ - return; + if(dbus_watch_get_enabled(dbus_watch)) { + sbus_add_watch(dbus_watch, data); } - - flags = dbus_watch_get_flags(dbus_watch); - - if (dbus_watch_get_enabled(dbus_watch)) { - if (flags & DBUS_WATCH_READABLE) { - TEVENT_FD_READABLE(watch->fde); - } - if (flags & DBUS_WATCH_WRITABLE) { - TEVENT_FD_WRITEABLE(watch->fde); - } - } else { - if (flags & DBUS_WATCH_READABLE) { - TEVENT_FD_NOT_READABLE(watch->fde); - } - if (flags & DBUS_WATCH_WRITABLE) { - TEVENT_FD_NOT_WRITEABLE(watch->fde); - } - } - - if (debug_level >= 8) { - event_flags = tevent_fd_get_flags(watch->fde); + else { + sbus_remove_watch(dbus_watch, data); } - DEBUG(8, ("%p: %p, %d=%s/%s\n", - dbus_watch, watch, flags, - ((event_flags & TEVENT_FD_READ)?"R":"-"), - ((event_flags & TEVENT_FD_WRITE)?"W":"-"))); } /* -- 1.6.2.5