aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Albinus2010-01-03 20:27:17 +0100
committerMichael Albinus2010-01-03 20:27:17 +0100
commit777013f2bf9f548902c03ffbca0e98507d12ee64 (patch)
tree0fa475092e80faec2f5f90f54f530757099e80ea
parent798c9eb5600072c2558de7620ad69b06aee46de7 (diff)
downloademacs-777013f2bf9f548902c03ffbca0e98507d12ee64.tar.gz
emacs-777013f2bf9f548902c03ffbca0e98507d12ee64.zip
* dbusbind.c (xd_add_watch): Improve debug message.
(xd_remove_watch): Improve debug message. If DATA is the session bus, unset D-Bus session environment. (Fdbus_init_bus): Pass the bus as argument to dbus_connection_set_watch_functions. (Bug#5283)
-rw-r--r--src/ChangeLog12
-rw-r--r--src/dbusbind.c23
2 files changed, 26 insertions, 9 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index d6e7f2c9791..2d1441964f2 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,11 @@
12010-01-03 Michael Albinus <michael.albinus@gmx.de>
2
3 * dbusbind.c (xd_add_watch): Improve debug message.
4 (xd_remove_watch): Improve debug message. If DATA is the session
5 bus, unset D-Bus session environment.
6 (Fdbus_init_bus): Pass the bus as argument to
7 dbus_connection_set_watch_functions. (Bug#5283)
8
12010-01-01 Chong Yidong <cyd@stupidchicken.com> 92010-01-01 Chong Yidong <cyd@stupidchicken.com>
2 10
3 * nsterm.m (ns_get_color): Fix buffer overflow (Bug#4763). 11 * nsterm.m (ns_get_color): Fix buffer overflow (Bug#4763).
@@ -144,7 +152,7 @@
1442009-12-15 Michael Albinus <michael.albinus@gmx.de> 1522009-12-15 Michael Albinus <michael.albinus@gmx.de>
145 153
146 * dbusbind.c (xd_retrieve_arg): Reorder declarations in order to 154 * dbusbind.c (xd_retrieve_arg): Reorder declarations in order to
147 avoid compiler warnings. (Bug #5217). 155 avoid compiler warnings. (Bug #5217)
148 156
1492009-12-14 Kenichi Handa <handa@m17n.org> 1572009-12-14 Kenichi Handa <handa@m17n.org>
150 158
@@ -5319,7 +5327,7 @@
5319 (XD_SIGNAL1, XD_SIGNAL2, XD_SIGNAL3): New macros. Throw Qdbus_error. 5327 (XD_SIGNAL1, XD_SIGNAL2, XD_SIGNAL3): New macros. Throw Qdbus_error.
5320 (xd_read_queued_messages): Catch Qdbus_error from the macros. 5328 (xd_read_queued_messages): Catch Qdbus_error from the macros.
5321 (all): Replace xsignal1, xsignal2, xsignal3 by the respective 5329 (all): Replace xsignal1, xsignal2, xsignal3 by the respective
5322 macro. (Bug#1186). 5330 macro. (Bug#1186)
5323 5331
53242008-10-23 Ali Bahrami <ali_gnu@emvision.com> (tiny change) 53322008-10-23 Ali Bahrami <ali_gnu@emvision.com> (tiny change)
5325 5333
diff --git a/src/dbusbind.c b/src/dbusbind.c
index 7c0be49ab77..59702ed93c4 100644
--- a/src/dbusbind.c
+++ b/src/dbusbind.c
@@ -761,14 +761,14 @@ xd_add_watch (watch, data)
761 if (dbus_watch_get_flags (watch) & DBUS_WATCH_READABLE) 761 if (dbus_watch_get_flags (watch) & DBUS_WATCH_READABLE)
762 { 762 {
763#if HAVE_DBUS_WATCH_GET_UNIX_FD 763#if HAVE_DBUS_WATCH_GET_UNIX_FD
764 /* TODO: Reverse these on Win32, which prefers the opposite. */ 764 /* TODO: Reverse these on Win32, which prefers the opposite. */
765 int fd = dbus_watch_get_unix_fd(watch); 765 int fd = dbus_watch_get_unix_fd(watch);
766 if (fd == -1) 766 if (fd == -1)
767 fd = dbus_watch_get_socket(watch); 767 fd = dbus_watch_get_socket(watch);
768#else 768#else
769 int fd = dbus_watch_get_fd(watch); 769 int fd = dbus_watch_get_fd(watch);
770#endif 770#endif
771 XD_DEBUG_MESSAGE ("%d", fd); 771 XD_DEBUG_MESSAGE ("fd %d", fd);
772 772
773 if (fd == -1) 773 if (fd == -1)
774 return FALSE; 774 return FALSE;
@@ -781,7 +781,8 @@ xd_add_watch (watch, data)
781 return TRUE; 781 return TRUE;
782} 782}
783 783
784/* Remove connection file descriptor from input_wait_mask. */ 784/* Remove connection file descriptor from input_wait_mask. DATA is
785 the used bus, either QCdbus_system_bus or QCdbus_session_bus. */
785void 786void
786xd_remove_watch (watch, data) 787xd_remove_watch (watch, data)
787 DBusWatch *watch; 788 DBusWatch *watch;
@@ -791,18 +792,25 @@ xd_remove_watch (watch, data)
791 if (dbus_watch_get_flags (watch) & DBUS_WATCH_READABLE) 792 if (dbus_watch_get_flags (watch) & DBUS_WATCH_READABLE)
792 { 793 {
793#if HAVE_DBUS_WATCH_GET_UNIX_FD 794#if HAVE_DBUS_WATCH_GET_UNIX_FD
794 /* TODO: Reverse these on Win32, which prefers the opposite. */ 795 /* TODO: Reverse these on Win32, which prefers the opposite. */
795 int fd = dbus_watch_get_unix_fd(watch); 796 int fd = dbus_watch_get_unix_fd(watch);
796 if (fd == -1) 797 if (fd == -1)
797 fd = dbus_watch_get_socket(watch); 798 fd = dbus_watch_get_socket(watch);
798#else 799#else
799 int fd = dbus_watch_get_fd(watch); 800 int fd = dbus_watch_get_fd(watch);
800#endif 801#endif
801 XD_DEBUG_MESSAGE ("%d", fd); 802 XD_DEBUG_MESSAGE ("fd %d", fd);
802 803
803 if (fd == -1) 804 if (fd == -1)
804 return; 805 return;
805 806
807 /* Unset session environment. */
808 if ((data != NULL) && (EQ ((Lisp_Object) data, QCdbus_session_bus)))
809 {
810 XD_DEBUG_MESSAGE ("unsetenv DBUS_SESSION_BUS_ADDRESS");
811 unsetenv ("DBUS_SESSION_BUS_ADDRESS");
812 }
813
806 /* Remove the file descriptor from input_wait_mask. */ 814 /* Remove the file descriptor from input_wait_mask. */
807 delete_keyboard_wait_descriptor (fd); 815 delete_keyboard_wait_descriptor (fd);
808 } 816 }
@@ -825,11 +833,12 @@ This is an internal function, it shall not be used outside dbus.el. */)
825 /* Open a connection to the bus. */ 833 /* Open a connection to the bus. */
826 connection = xd_initialize (bus); 834 connection = xd_initialize (bus);
827 835
828 /* Add the watch functions. */ 836 /* Add the watch functions. We pass also the bus as data, in order
837 to distinguish between the busses in xd_remove_watch. */
829 if (!dbus_connection_set_watch_functions (connection, 838 if (!dbus_connection_set_watch_functions (connection,
830 xd_add_watch, 839 xd_add_watch,
831 xd_remove_watch, 840 xd_remove_watch,
832 NULL, NULL, NULL)) 841 NULL, (void *) bus, NULL))
833 XD_SIGNAL1 (build_string ("Cannot add watch functions")); 842 XD_SIGNAL1 (build_string ("Cannot add watch functions"));
834 843
835 /* Return. */ 844 /* Return. */