Fix the case when the requested name is already in use
authorVinicius Costa Gomes <vinicius.gomes@openbossa.org>
Mon, 1 Feb 2010 19:16:22 +0000 (16:16 -0300)
committerMarcel Holtmann <marcel@holtmann.org>
Sun, 7 Mar 2010 22:31:24 +0000 (14:31 -0800)
We weren't setting the dbus error in this situation.

gdbus/mainloop.c

index 7f2d001..ec10ab0 100644 (file)
@@ -347,8 +347,12 @@ gboolean g_dbus_request_name(DBusConnection *connection, const char *name,
                        return FALSE;
        }
 
-       if (result != DBUS_REQUEST_NAME_REPLY_PRIMARY_OWNER)
+       if (result != DBUS_REQUEST_NAME_REPLY_PRIMARY_OWNER) {
+               if (error != NULL)
+                       dbus_set_error(error, name, "Name already in use");
+
                return FALSE;
+       }
 
        return TRUE;
 }