summaryrefslogtreecommitdiff
path: root/src/network/networkd-link.c
diff options
context:
space:
mode:
authorTom Gundersen <teg@jklm.no>2014-01-18 01:37:35 +0100
committerTom Gundersen <teg@jklm.no>2014-01-18 01:56:41 +0100
commitbcbca8291fe3beaed36dd672d8b544840cfc49de (patch)
tree29951bf149c2c59b015f3e8f35493b370768131a /src/network/networkd-link.c
parentb2ad8a16eea1d125159fbd71974ea7c24dc0ab0a (diff)
networkd: don't hard depend on system bus
We may not have a dbus daemon in the initrd (until we can rely on kdbus). In this case, simply ignore any attempts at using the bus. There is only one user for now, but surely more to come. In order to work reliably in the real root without kdbus, but at the same time don't delay boot when kdbus is in use, order ourselves after dbus.service.
Diffstat (limited to 'src/network/networkd-link.c')
-rw-r--r--src/network/networkd-link.c6
1 files changed, 5 insertions, 1 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",