mirror of
https://github.com/systemd/systemd-stable.git
synced 2025-01-12 09:17:44 +03:00
dbus: fix name allocation logic
This commit is contained in:
parent
a2e5283217
commit
add10b5ae7
@ -524,8 +524,15 @@ static int connect_bus(DBusConnection **_bus) {
|
||||
goto fail;
|
||||
}
|
||||
|
||||
if (dbus_bus_request_name(bus, "org.freedesktop.hostname1", DBUS_NAME_FLAG_DO_NOT_QUEUE, &error) < 0) {
|
||||
log_error("Failed to register name on bus: %s", error.message);
|
||||
r = dbus_bus_request_name(bus, "org.freedesktop.hostname1", DBUS_NAME_FLAG_DO_NOT_QUEUE, &error);
|
||||
if (dbus_error_is_set(&error)) {
|
||||
log_error("Failed to register name on bus: %s", bus_error_message(&error));
|
||||
r = -EEXIST;
|
||||
goto fail;
|
||||
}
|
||||
|
||||
if (r != DBUS_REQUEST_NAME_REPLY_PRIMARY_OWNER) {
|
||||
log_error("Failed to acquire name.");
|
||||
r = -EEXIST;
|
||||
goto fail;
|
||||
}
|
||||
|
@ -540,8 +540,15 @@ static int connect_bus(DBusConnection **_bus) {
|
||||
goto fail;
|
||||
}
|
||||
|
||||
if (dbus_bus_request_name(bus, "org.freedesktop.locale1", DBUS_NAME_FLAG_DO_NOT_QUEUE, &error) < 0) {
|
||||
log_error("Failed to register name on bus: %s", error.message);
|
||||
r = dbus_bus_request_name(bus, "org.freedesktop.locale1", DBUS_NAME_FLAG_DO_NOT_QUEUE, &error);
|
||||
if (dbus_error_is_set(&error)) {
|
||||
log_error("Failed to register name on bus: %s", bus_error_message(&error));
|
||||
r = -EEXIST;
|
||||
goto fail;
|
||||
}
|
||||
|
||||
if (r != DBUS_REQUEST_NAME_REPLY_PRIMARY_OWNER) {
|
||||
log_error("Failed to acquire name.");
|
||||
r = -EEXIST;
|
||||
goto fail;
|
||||
}
|
||||
|
@ -543,8 +543,15 @@ static int connect_bus(DBusConnection **_bus) {
|
||||
goto fail;
|
||||
}
|
||||
|
||||
if (dbus_bus_request_name(bus, "org.freedesktop.timedate1", DBUS_NAME_FLAG_DO_NOT_QUEUE, &error) < 0) {
|
||||
log_error("Failed to register name on bus: %s", error.message);
|
||||
r = dbus_bus_request_name(bus, "org.freedesktop.timedate1", DBUS_NAME_FLAG_DO_NOT_QUEUE, &error);
|
||||
if (dbus_error_is_set(&error)) {
|
||||
log_error("Failed to register name on bus: %s", bus_error_message(&error));
|
||||
r = -EEXIST;
|
||||
goto fail;
|
||||
}
|
||||
|
||||
if (r != DBUS_REQUEST_NAME_REPLY_PRIMARY_OWNER) {
|
||||
log_error("Failed to acquire name.");
|
||||
r = -EEXIST;
|
||||
goto fail;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user