summaryrefslogtreecommitdiffstats
path: root/src/network
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2021-04-08 15:04:18 +0200
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2021-04-08 15:04:18 +0200
commit5dbec9bd3223c908949c20a97d6d280c231995b4 (patch)
treee1367be2aeb8e01ef7f6061c5128616944bf384a /src/network
parentsd-bus: make sd_bus_is_{ready,open} accept NULL (diff)
downloadsystemd-5dbec9bd3223c908949c20a97d6d280c231995b4.tar.xz
systemd-5dbec9bd3223c908949c20a97d6d280c231995b4.zip
networkd: simplify sd_bus_is_ready() checks
Also add "system" in the messages, because we set the internal value, and are just skipping the setting of the external value, so the message could be confusing without that clarification.
Diffstat (limited to 'src/network')
-rw-r--r--src/network/networkd-dhcp-common.c2
-rw-r--r--src/network/networkd-link-bus.c2
-rw-r--r--src/network/networkd-manager-bus.c2
-rw-r--r--src/network/networkd-manager.c9
4 files changed, 7 insertions, 8 deletions
diff --git a/src/network/networkd-dhcp-common.c b/src/network/networkd-dhcp-common.c
index 0de1892fc9..9677dfb0c3 100644
--- a/src/network/networkd-dhcp-common.c
+++ b/src/network/networkd-dhcp-common.c
@@ -167,7 +167,7 @@ int manager_request_product_uuid(Manager *m, Link *link) {
return log_oom();
}
- if (!m->bus || sd_bus_is_ready(m->bus) <= 0) {
+ if (sd_bus_is_ready(m->bus) <= 0) {
log_debug("Not connected to system bus, requesting product UUID later.");
return 0;
}
diff --git a/src/network/networkd-link-bus.c b/src/network/networkd-link-bus.c
index 841d76b461..3311dafd6a 100644
--- a/src/network/networkd-link-bus.c
+++ b/src/network/networkd-link-bus.c
@@ -854,7 +854,7 @@ int link_send_changed_strv(Link *link, char **properties) {
assert(link->manager);
assert(properties);
- if (!link->manager->bus || sd_bus_is_ready(link->manager->bus) <= 0)
+ if (sd_bus_is_ready(link->manager->bus) <= 0)
return 0;
p = link_bus_path(link);
diff --git a/src/network/networkd-manager-bus.c b/src/network/networkd-manager-bus.c
index a08dff58e7..138d765414 100644
--- a/src/network/networkd-manager-bus.c
+++ b/src/network/networkd-manager-bus.c
@@ -339,7 +339,7 @@ int manager_send_changed_strv(Manager *manager, char **properties) {
assert(manager);
assert(properties);
- if (!manager->bus || sd_bus_is_ready(manager->bus) <= 0)
+ if (sd_bus_is_ready(manager->bus) <= 0)
return 0;
return sd_bus_emit_properties_changed_strv(
diff --git a/src/network/networkd-manager.c b/src/network/networkd-manager.c
index bfdb1f8c96..a8db2cc44b 100644
--- a/src/network/networkd-manager.c
+++ b/src/network/networkd-manager.c
@@ -767,8 +767,8 @@ int manager_set_hostname(Manager *m, const char *hostname) {
if (r < 0)
return r;
- if (!m->bus || sd_bus_is_ready(m->bus) <= 0) {
- log_debug("Not connected to system bus, setting hostname later.");
+ if (sd_bus_is_ready(m->bus) <= 0) {
+ log_debug("Not connected to system bus, setting system hostname later.");
return 0;
}
@@ -784,7 +784,6 @@ int manager_set_hostname(Manager *m, const char *hostname) {
"sb",
hostname,
false);
-
if (r < 0)
return log_error_errno(r, "Could not set transient hostname: %m");
@@ -817,8 +816,8 @@ int manager_set_timezone(Manager *m, const char *tz) {
if (r < 0)
return r;
- if (!m->bus || sd_bus_is_ready(m->bus) <= 0) {
- log_debug("Not connected to system bus, setting timezone later.");
+ if (sd_bus_is_ready(m->bus) <= 0) {
+ log_debug("Not connected to system bus, setting system timezone later.");
return 0;
}