From 52ea0f2cbbf30d7652c38ae5ec89e663ea780b5e Mon Sep 17 00:00:00 2001 From: Colin Walters Date: Wed, 26 Mar 2008 10:28:40 -0400 Subject: Set default exit_on_disconnect after registration 2008-03-26 Colin Walters Patch from Scott James Remnant * dbus/dbus-bus.c: Set default exit_on_disconnect after registration with the bus, not before. This ensures that programs which wish to set exit_on_disconnect to FALSE will not be terminated if the bus exits during registration. (FDO Bug #15112) --- ChangeLog | 9 +++++++++ dbus/dbus-bus.c | 12 ++++++------ 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/ChangeLog b/ChangeLog index 96cecd01..5503219a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2008-03-26 Colin Walters + + Patch from Scott James Remnant + + * dbus/dbus-bus.c: Set default exit_on_disconnect after registration with + the bus, not before. This ensures that programs which wish to set + exit_on_disconnect to FALSE will not be terminated if the bus exits + during registration. (FDO Bug #15112) + 2008-03-04 John (J5) Palmieri * fix broken poll on Mac OSX - build patch by Benjamin Reed diff --git a/dbus/dbus-bus.c b/dbus/dbus-bus.c index c7f43e8c..e159dae7 100644 --- a/dbus/dbus-bus.c +++ b/dbus/dbus-bus.c @@ -436,12 +436,6 @@ internal_bus_get (DBusBusType type, return NULL; } - /* By default we're bound to the lifecycle of - * the message bus. - */ - dbus_connection_set_exit_on_disconnect (connection, - TRUE); - if (!dbus_bus_register (connection, error)) { _DBUS_ASSERT_ERROR_IS_SET (error); @@ -461,6 +455,12 @@ internal_bus_get (DBusBusType type, bus_connections[type] = connection; } + /* By default we're bound to the lifecycle of + * the message bus. + */ + dbus_connection_set_exit_on_disconnect (connection, + TRUE); + _DBUS_LOCK (bus_datas); bd = ensure_bus_data (connection); _dbus_assert (bd != NULL); /* it should have been created on -- cgit From 4058579dae09659ea2dc7f3dd20e034a3be3b0bf Mon Sep 17 00:00:00 2001 From: Havoc Pennington Date: Thu, 27 Mar 2008 16:52:40 -0400 Subject: Do not provide a signature to dbus_message_iter_open_container() when opening a dict entry. 2008-03-27 Havoc Pennington * tools/dbus-send.c (append_dict): Do not provide a signature to dbus_message_iter_open_container() when opening a dict entry. --- ChangeLog | 5 +++++ tools/dbus-send.c | 6 +----- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index 5503219a..5a5f5ab1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2008-03-27 Havoc Pennington + + * tools/dbus-send.c (append_dict): Do not provide a signature to + dbus_message_iter_open_container() when opening a dict entry. + 2008-03-26 Colin Walters Patch from Scott James Remnant diff --git a/tools/dbus-send.c b/tools/dbus-send.c index 66d0bcf9..407c0497 100644 --- a/tools/dbus-send.c +++ b/tools/dbus-send.c @@ -150,14 +150,10 @@ append_dict (DBusMessageIter *iter, int keytype, int valtype, const char *value) while (val != NULL) { DBusMessageIter subiter; - char sig[3]; - sig[0] = keytype; - sig[1] = valtype; - sig[2] = '\0'; dbus_message_iter_open_container (iter, DBUS_TYPE_DICT_ENTRY, - sig, + NULL, &subiter); append_arg (&subiter, keytype, val); -- cgit From 193ebb7083fb1e9dccff04fc0a9d805a0aa03ea2 Mon Sep 17 00:00:00 2001 From: Colin Walters Date: Mon, 31 Mar 2008 18:16:00 -0400 Subject: Make sure we call XFlush() on all code paths (FDO bug #15293) --- ChangeLog | 7 +++++++ tools/dbus-launch-x11.c | 10 +++++----- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index 5a5f5ab1..4cd19aab 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2008-03-26 Colin Walters + + Patch from Owen Taylor + + * tools/dbus-launch-x11.c: Make sure we call XFlush() + on all code paths (FDO bug #15293) + 2008-03-27 Havoc Pennington * tools/dbus-send.c (append_dict): Do not provide a signature to diff --git a/tools/dbus-launch-x11.c b/tools/dbus-launch-x11.c index 927d8634..442e9ba2 100644 --- a/tools/dbus-launch-x11.c +++ b/tools/dbus-launch-x11.c @@ -341,7 +341,7 @@ static Window set_address_in_x11(char *address, pid_t pid) { char *current_address; - Window wid; + Window wid = None; unsigned long pid32; /* Xlib property functions want _long_ not 32-bit for format "32" */ /* lock the X11 display to make sure we're doing this atomically */ @@ -350,16 +350,14 @@ set_address_in_x11(char *address, pid_t pid) if (!x11_get_address (¤t_address, NULL, NULL)) { /* error! */ - XUngrabServer (xdisplay); - return None; + goto out; } if (current_address != NULL) { /* someone saved the address in the meantime */ - XUngrabServer (xdisplay); free (current_address); - return None; + goto out; } /* Create our window */ @@ -378,9 +376,11 @@ set_address_in_x11(char *address, pid_t pid) /* Now grab the selection */ XSetSelectionOwner (xdisplay, selection_atom, wid, CurrentTime); + out: /* Ungrab the server to let other people use it too */ XUngrabServer (xdisplay); + /* And make sure that the ungrab gets sent to X11 */ XFlush (xdisplay); return wid; -- cgit From 0bfc5e8d23a5ae56eee5ef2073911cddcbd0c4b0 Mon Sep 17 00:00:00 2001 From: Colin Walters Date: Mon, 31 Mar 2008 18:20:07 -0400 Subject: Check for X11 events before selecting (FDO bug #15293) --- ChangeLog | 9 ++++++++- tools/dbus-launch.c | 18 +++++++++++++----- 2 files changed, 21 insertions(+), 6 deletions(-) diff --git a/ChangeLog b/ChangeLog index 4cd19aab..56280156 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,4 +1,11 @@ -2008-03-26 Colin Walters +2008-03-31 Colin Walters + + Patch from Owen Taylor + + * tools/dbus-launch-x11.c: Check for X11 events before + selecting (FDO bug #15293) + +2008-03-31 Colin Walters Patch from Owen Taylor diff --git a/tools/dbus-launch.c b/tools/dbus-launch.c index 6a10ffa3..216f7435 100644 --- a/tools/dbus-launch.c +++ b/tools/dbus-launch.c @@ -458,6 +458,17 @@ kill_bus_when_session_ends (void) while (TRUE) { +#ifdef DBUS_BUILD_X11 + /* Dump events on the floor, and let + * IO error handler run if we lose + * the X connection. It's important to + * run this before going into select() since + * we might have queued outgoing messages or + * events. + */ + x11_handle_event (); +#endif + FD_ZERO (&read_set); FD_ZERO (&err_set); @@ -472,7 +483,7 @@ kill_bus_when_session_ends (void) FD_SET (x_fd, &read_set); FD_SET (x_fd, &err_set); } - + select (MAX (tty_fd, x_fd) + 1, &read_set, NULL, &err_set, NULL); @@ -483,15 +494,12 @@ kill_bus_when_session_ends (void) } #ifdef DBUS_BUILD_X11 - /* Dump events on the floor, and let - * IO error handler run if we lose - * the X connection + /* Events will be processed before we select again */ if (x_fd >= 0) verbose ("X fd condition reading = %d error = %d\n", FD_ISSET (x_fd, &read_set), FD_ISSET (x_fd, &err_set)); - x11_handle_event (); #endif if (tty_fd >= 0) -- cgit From 68f69d38182ed5974984b0434086e6a288b477cb Mon Sep 17 00:00:00 2001 From: Frederic Crozat Date: Tue, 1 Apr 2008 18:09:46 +0200 Subject: Fixes for the inotify configuration file monitor backend. 2008-04-01 Timo Hoenig Patch from Frederic Crozat * bus/dir-watch-inotify.c (bus_watch_directory): Only monitor IN_CLOSE_WRITE, IN_DELETE, IN_MOVE_TO and IN_MOVE_FROM events. This way, only atomic changes to configuration file are monitored. * bus/dir-watch-inotify.c (_handle_inotify_watch): Fix typo in _dbus_verbose function call * bus/dir-watch-inotify.c (bus_drop_all_directory_watches): Use _dbus_strerror instead of perror --- ChangeLog | 12 ++++++++++++ bus/dir-watch-inotify.c | 6 +++--- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 56280156..527ac89c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,15 @@ +2008-04-01 Timo Hoenig + + Patch from Frederic Crozat + + * bus/dir-watch-inotify.c (bus_watch_directory): Only monitor + IN_CLOSE_WRITE, IN_DELETE, IN_MOVE_TO and IN_MOVE_FROM events. This + way, only atomic changes to configuration file are monitored. + * bus/dir-watch-inotify.c (_handle_inotify_watch): Fix typo in + _dbus_verbose function call + * bus/dir-watch-inotify.c (bus_drop_all_directory_watches): Use + _dbus_strerror instead of perror + 2008-03-31 Colin Walters Patch from Owen Taylor diff --git a/bus/dir-watch-inotify.c b/bus/dir-watch-inotify.c index 1622cde2..e15faadc 100644 --- a/bus/dir-watch-inotify.c +++ b/bus/dir-watch-inotify.c @@ -64,7 +64,7 @@ _handle_inotify_watch (DBusWatch *watch, unsigned int flags, void *data) ret = read (inotify_fd, buffer, INOTIFY_BUF_LEN); if (ret < 0) - _dbus_verbose ("Error reading inotify event: '%s'\n, _dbus_strerror(errno)"); + _dbus_verbose ("Error reading inotify event: '%s'\n", _dbus_strerror(errno)); else if (!ret) _dbus_verbose ("Error reading inotify event: buffer too small\n"); @@ -134,7 +134,7 @@ bus_watch_directory (const char *dir, BusContext *context) goto out; } - wd = inotify_add_watch (inotify_fd, dir, IN_MODIFY | IN_CREATE | IN_DELETE); + wd = inotify_add_watch (inotify_fd, dir, IN_CLOSE_WRITE | IN_DELETE | IN_MOVED_TO | IN_MOVED_FROM); if (wd < 0) { _dbus_warn ("Cannot setup inotify for '%s'; error '%s'\n", dir, _dbus_strerror (errno)); @@ -156,7 +156,7 @@ bus_drop_all_directory_watches (void) _dbus_verbose ("Dropping all watches on config directories\n"); ret = close (inotify_fd); if (ret) - _dbus_verbose ("Error dropping watches: '%s'\n", perror(ret)); + _dbus_verbose ("Error dropping watches: '%s'\n", _dbus_strerror(errno)); num_wds = 0; inotify_fd = -1; -- cgit