chiark
/
gitweb
/
~ianmdlvl
/
elogind.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
main: add link to wiki page with longer explanation of the /usr madness
[elogind.git]
/
src
/
dbus.c
diff --git
a/src/dbus.c
b/src/dbus.c
index 4365bca7bf6de7253587046ddb46348c2662a600..965a3e2f21586daf2e08b995f82b20768a97289a 100644
(file)
--- a/
src/dbus.c
+++ b/
src/dbus.c
@@
-418,7
+418,7
@@
static DBusHandlerResult api_bus_message_filter(DBusConnection *connection, DBus
goto oom;
}
goto oom;
}
- /* On success we don't do anything, the service will be sp
wa
ned now */
+ /* On success we don't do anything, the service will be sp
aw
ned now */
}
}
}
}
@@
-864,7
+864,7
@@
static int bus_init_api(Manager *m) {
if (m->running_as == MANAGER_SYSTEM && m->system_bus)
m->api_bus = m->system_bus;
else {
if (m->running_as == MANAGER_SYSTEM && m->system_bus)
m->api_bus = m->system_bus;
else {
- if (!(m->api_bus = dbus_bus_get_private(m->running_as == MANAGER_
SESSION
? DBUS_BUS_SESSION : DBUS_BUS_SYSTEM, &error))) {
+ if (!(m->api_bus = dbus_bus_get_private(m->running_as == MANAGER_
USER
? DBUS_BUS_SESSION : DBUS_BUS_SYSTEM, &error))) {
log_debug("Failed to get API D-Bus connection, retrying later: %s", error.message);
r = 0;
goto fail;
log_debug("Failed to get API D-Bus connection, retrying later: %s", error.message);
r = 0;
goto fail;
@@
-982,7
+982,7
@@
fail:
return r;
}
return r;
}
-int bus_init(Manager *m) {
+int bus_init(Manager *m
, bool try_bus_connect
) {
int r;
if (set_ensure_allocated(&m->bus_connections, trivial_hash_func, trivial_compare_func) < 0 ||
int r;
if (set_ensure_allocated(&m->bus_connections, trivial_hash_func, trivial_compare_func) < 0 ||
@@
-998,14
+998,18
@@
int bus_init(Manager *m) {
}
if (m->subscribed_data_slot < 0)
}
if (m->subscribed_data_slot < 0)
- if (!dbus_
pending_call
_allocate_data_slot(&m->subscribed_data_slot)) {
+ if (!dbus_
connection
_allocate_data_slot(&m->subscribed_data_slot)) {
log_error("Not enough memory");
return -ENOMEM;
}
log_error("Not enough memory");
return -ENOMEM;
}
- if ((r = bus_init_system(m)) < 0 ||
- (r = bus_init_api(m)) < 0 ||
- (r = bus_init_private(m)) < 0)
+ if (try_bus_connect) {
+ if ((r = bus_init_system(m)) < 0 ||
+ (r = bus_init_api(m)) < 0)
+ return r;
+ }
+
+ if ((r = bus_init_private(m)) < 0)
return r;
return 0;
return r;
return 0;
@@
-1110,7
+1114,7
@@
void bus_done(Manager *m) {
dbus_pending_call_free_data_slot(&m->name_data_slot);
if (m->subscribed_data_slot >= 0)
dbus_pending_call_free_data_slot(&m->name_data_slot);
if (m->subscribed_data_slot >= 0)
- dbus_
pending_call
_free_data_slot(&m->subscribed_data_slot);
+ dbus_
connection
_free_data_slot(&m->subscribed_data_slot);
}
static void query_pid_pending_cb(DBusPendingCall *pending, void *userdata) {
}
static void query_pid_pending_cb(DBusPendingCall *pending, void *userdata) {
@@
-1357,6
+1361,7
@@
static const char *error_to_dbus(int error) {
return DBUS_ERROR_FILE_EXISTS;
case -ETIMEDOUT:
return DBUS_ERROR_FILE_EXISTS;
case -ETIMEDOUT:
+ case -ETIME:
return DBUS_ERROR_TIMEOUT;
case -EIO:
return DBUS_ERROR_TIMEOUT;
case -EIO: