aboutsummaryrefslogtreecommitdiffstats
path: root/src/dbusbind.c
diff options
context:
space:
mode:
authorMichael Albinus2011-01-10 12:28:31 +0100
committerMichael Albinus2011-01-10 12:28:31 +0100
commit2bc92a930d01f1c0d4b79f8f028ab45312e4f055 (patch)
tree8b07f032e8fb5fd03c09cc6e401c8b9e4770bcc2 /src/dbusbind.c
parent5c0b407077350a6d1c12983a3937f2a18f4ef3c9 (diff)
downloademacs-2bc92a930d01f1c0d4b79f8f028ab45312e4f055.tar.gz
emacs-2bc92a930d01f1c0d4b79f8f028ab45312e4f055.zip
* dbusbind.c (Fdbus_register_service): Raise an error in case of
unexpected return values. (Fdbus_register_method): Remove connection initialization.
Diffstat (limited to 'src/dbusbind.c')
-rw-r--r--src/dbusbind.c37
1 files changed, 17 insertions, 20 deletions
diff --git a/src/dbusbind.c b/src/dbusbind.c
index 2e0a71cad62..0c59c08f5b7 100644
--- a/src/dbusbind.c
+++ b/src/dbusbind.c
@@ -1888,8 +1888,8 @@ Example:
1888 => :primary-owner. 1888 => :primary-owner.
1889 1889
1890\(dbus-register-service 1890\(dbus-register-service
1891:session "org.freedesktop.TextEditor" 1891 :session "org.freedesktop.TextEditor"
1892dbus-service-allow-replacement dbus-service-replace-existing) 1892 dbus-service-allow-replacement dbus-service-replace-existing)
1893 1893
1894 => :already-owner. 1894 => :already-owner.
1895 1895
@@ -1939,18 +1939,20 @@ usage: (dbus-register-service BUS SERVICE &rest FLAGS) */)
1939 dbus_error_free (&derror); 1939 dbus_error_free (&derror);
1940 1940
1941 /* Return object. */ 1941 /* Return object. */
1942 switch (result) { 1942 switch (result)
1943 case DBUS_REQUEST_NAME_REPLY_PRIMARY_OWNER: 1943 {
1944 return QCdbus_request_name_reply_primary_owner; 1944 case DBUS_REQUEST_NAME_REPLY_PRIMARY_OWNER:
1945 case DBUS_REQUEST_NAME_REPLY_IN_QUEUE: 1945 return QCdbus_request_name_reply_primary_owner;
1946 return QCdbus_request_name_reply_in_queue; 1946 case DBUS_REQUEST_NAME_REPLY_IN_QUEUE:
1947 case DBUS_REQUEST_NAME_REPLY_EXISTS: 1947 return QCdbus_request_name_reply_in_queue;
1948 return QCdbus_request_name_reply_exists; 1948 case DBUS_REQUEST_NAME_REPLY_EXISTS:
1949 case DBUS_REQUEST_NAME_REPLY_ALREADY_OWNER: 1949 return QCdbus_request_name_reply_exists;
1950 return QCdbus_request_name_reply_already_owner; 1950 case DBUS_REQUEST_NAME_REPLY_ALREADY_OWNER:
1951 default: 1951 return QCdbus_request_name_reply_already_owner;
1952 return Qnil; 1952 default:
1953 } 1953 /* This should not happen. */
1954 XD_SIGNAL2 (build_string ("Could not register service"), service);
1955 }
1954} 1956}
1955 1957
1956DEFUN ("dbus-register-signal", Fdbus_register_signal, Sdbus_register_signal, 1958DEFUN ("dbus-register-signal", Fdbus_register_signal, Sdbus_register_signal,
@@ -2129,8 +2131,6 @@ discovering the still incomplete interface.*/)
2129 Lisp_Object dont_register_service) 2131 Lisp_Object dont_register_service)
2130{ 2132{
2131 Lisp_Object key, key1, value; 2133 Lisp_Object key, key1, value;
2132 DBusConnection *connection;
2133 int result;
2134 DBusError derror; 2134 DBusError derror;
2135 Lisp_Object args[2] = { bus, service }; 2135 Lisp_Object args[2] = { bus, service };
2136 2136
@@ -2144,11 +2144,8 @@ discovering the still incomplete interface.*/)
2144 /* TODO: We must check for a valid service name, otherwise there is 2144 /* TODO: We must check for a valid service name, otherwise there is
2145 a segmentation fault. */ 2145 a segmentation fault. */
2146 2146
2147 /* Open a connection to the bus. */
2148 connection = xd_initialize (bus, TRUE);
2149
2150 /* Request the name. */ 2147 /* Request the name. */
2151 if (NILP(dont_register_service)) 2148 if (NILP (dont_register_service))
2152 Fdbus_register_service (2, args); 2149 Fdbus_register_service (2, args);
2153 2150
2154 /* Create a hash table entry. We use nil for the unique name, 2151 /* Create a hash table entry. We use nil for the unique name,