summaryrefslogtreecommitdiff
path: root/src/network/networkd-link.c
diff options
context:
space:
mode:
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",