summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/network/networkd-link.c6
-rw-r--r--src/network/networkd-manager.c7
2 files changed, 11 insertions, 2 deletions
diff --git a/src/network/networkd-link.c b/src/network/networkd-link.c
index 7f692d1f9b..f1a2695e83 100644
--- a/src/network/networkd-link.c
+++ b/src/network/networkd-link.c
@@ -325,11 +325,15 @@ static int set_hostname(sd_bus *bus, const char *hostname) {
_cleanup_bus_message_unref_ sd_bus_message *m = NULL;
int r = 0;
- assert(bus);
assert(hostname);
log_debug("Setting transient hostname: '%s'", hostname);
+ if (!bus) { /* TODO: replace by assert when we can rely on kdbus */
+ log_info("Not connected to system bus, ignoring transient hostname.");
+ return 0;
+ }
+
r = sd_bus_message_new_method_call(
bus,
"org.freedesktop.hostname1",
diff --git a/src/network/networkd-manager.c b/src/network/networkd-manager.c
index 8eaf101df3..c630ed7ed9 100644
--- a/src/network/networkd-manager.c
+++ b/src/network/networkd-manager.c
@@ -55,7 +55,7 @@ int manager_new(Manager **ret) {
return r;
r = sd_bus_default_system(&m->bus);
- if (r < 0)
+ if (r < 0 && r != -ENOENT) /* TODO: drop when we can rely on kdbus */
return r;
m->udev = udev_new();
@@ -288,6 +288,11 @@ int manager_rtnl_listen(Manager *m) {
int manager_bus_listen(Manager *m) {
int r;
+ assert(m->event);
+
+ if (!m->bus) /* TODO: drop when we can rely on kdbus */
+ return 0;
+
r = sd_bus_attach_event(m->bus, m->event, 0);
if (r < 0)
return r;