Bug 1418985 - pass valid error parameter to dbus_bus_request_name() instead of nullptr, r?jhorak
MozReview-Commit-ID: 4Gv517107zt
--- a/toolkit/components/remote/nsDBusRemoteService.cpp
+++ b/toolkit/components/remote/nsDBusRemoteService.cpp
@@ -167,23 +167,26 @@ nsDBusRemoteService::Startup(const char*
if (!mConnection)
return NS_ERROR_FAILURE;
dbus_connection_set_exit_on_disconnect(mConnection, false);
nsAutoCString interfaceName;
interfaceName = nsPrintfCString("org.mozilla.%s.%s", aAppName, aProfileName);
- int ret = dbus_bus_request_name(mConnection, interfaceName.get(),
- DBUS_NAME_FLAG_DO_NOT_QUEUE, nullptr);
+ DBusError err;
+ dbus_error_init(&err);
+ dbus_bus_request_name(mConnection, interfaceName.get(),
+ DBUS_NAME_FLAG_DO_NOT_QUEUE, &err);
// The interface is already owned - there is another application/profile
// instance already running.
- if (ret == -1) {
- mConnection = nullptr;
- return NS_ERROR_FAILURE;
+ if (dbus_error_is_set(&err)) {
+ dbus_error_free(&err);
+ mConnection = nullptr;
+ return NS_ERROR_FAILURE;
}
nsAutoCString objectName;
objectName = nsPrintfCString("/org/mozilla/%s/Remote", aAppName);
if (!dbus_connection_register_object_path(mConnection, objectName.get(),
&remoteHandlersTable, this)) {
mConnection = nullptr;