mirror of
https://github.com/systemd/systemd.git
synced 2025-01-07 21:18:41 +03:00
importd: unify setup of bus connectivity in one place
This commit is contained in:
parent
609bc3ae16
commit
3b2e99ed8c
@ -706,10 +706,6 @@ static int manager_new(Manager **ret) {
|
|||||||
if (r < 0)
|
if (r < 0)
|
||||||
log_debug_errno(r, "Failed to enable watchdog logic, ignoring: %m");
|
log_debug_errno(r, "Failed to enable watchdog logic, ignoring: %m");
|
||||||
|
|
||||||
r = sd_bus_default_system(&m->bus);
|
|
||||||
if (r < 0)
|
|
||||||
return r;
|
|
||||||
|
|
||||||
m->notify_fd = socket(AF_UNIX, SOCK_DGRAM|SOCK_CLOEXEC|SOCK_NONBLOCK, 0);
|
m->notify_fd = socket(AF_UNIX, SOCK_DGRAM|SOCK_CLOEXEC|SOCK_NONBLOCK, 0);
|
||||||
if (m->notify_fd < 0)
|
if (m->notify_fd < 0)
|
||||||
return -errno;
|
return -errno;
|
||||||
@ -1703,10 +1699,16 @@ static const BusObjectImplementation manager_object = {
|
|||||||
.children = BUS_IMPLEMENTATIONS(&transfer_object),
|
.children = BUS_IMPLEMENTATIONS(&transfer_object),
|
||||||
};
|
};
|
||||||
|
|
||||||
static int manager_add_bus_objects(Manager *m) {
|
static int manager_connect_bus(Manager *m) {
|
||||||
int r;
|
int r;
|
||||||
|
|
||||||
assert(m);
|
assert(m);
|
||||||
|
assert(m->event);
|
||||||
|
assert(!m->bus);
|
||||||
|
|
||||||
|
r = sd_bus_default_system(&m->bus);
|
||||||
|
if (r < 0)
|
||||||
|
return log_error_errno(r, "Failed to get system bus connection: %m");
|
||||||
|
|
||||||
r = bus_add_implementation(m->bus, &manager_object, m);
|
r = bus_add_implementation(m->bus, &manager_object, m);
|
||||||
if (r < 0)
|
if (r < 0)
|
||||||
@ -1780,7 +1782,7 @@ static int run(int argc, char *argv[]) {
|
|||||||
|
|
||||||
manager_parse_env(m);
|
manager_parse_env(m);
|
||||||
|
|
||||||
r = manager_add_bus_objects(m);
|
r = manager_connect_bus(m);
|
||||||
if (r < 0)
|
if (r < 0)
|
||||||
return r;
|
return r;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user