summaryrefslogtreecommitdiff
path: root/src/network/networkd-link.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2015-06-10 15:09:03 +0200
committerLennart Poettering <lennart@poettering.net>2015-06-10 15:09:03 +0200
commit521446dbff601603a8d41774eca8866a5613b04c (patch)
tree11bb22c43eda5c278a5fbcfa676ca05ebf0a9bfe /src/network/networkd-link.c
parent251811f69b5e21f2405665452dd01a9085dea229 (diff)
parent9c34154a2b4adddf0ef81bb732e78289f7a87f06 (diff)
Merge pull request #138 from utezduyar/use-async-convenience-function-on-setting-hostname
networkd: use async convenience call to set hostname
Diffstat (limited to 'src/network/networkd-link.c')
-rw-r--r--src/network/networkd-link.c20
1 files changed, 8 insertions, 12 deletions
diff --git a/src/network/networkd-link.c b/src/network/networkd-link.c
index 127bc1249a..7841f69dab 100644
--- a/src/network/networkd-link.c
+++ b/src/network/networkd-link.c
@@ -749,7 +749,6 @@ static int set_hostname_handler(sd_bus_message *m, void *userdata, sd_bus_error
}
int link_set_hostname(Link *link, const char *hostname) {
- _cleanup_bus_message_unref_ sd_bus_message *m = NULL;
int r = 0;
assert(link);
@@ -764,22 +763,19 @@ int link_set_hostname(Link *link, const char *hostname) {
return 0;
}
- r = sd_bus_message_new_method_call(
+ r = sd_bus_call_method_async(
link->manager->bus,
- &m,
+ NULL,
"org.freedesktop.hostname1",
"/org/freedesktop/hostname1",
"org.freedesktop.hostname1",
- "SetHostname");
- if (r < 0)
- return r;
-
- r = sd_bus_message_append(m, "sb", hostname, false);
- if (r < 0)
- return r;
+ "SetHostname",
+ set_hostname_handler,
+ link,
+ "sb",
+ hostname,
+ false);
- r = sd_bus_call_async(link->manager->bus, NULL, m, set_hostname_handler,
- link, 0);
if (r < 0)
return log_link_error_errno(link, r, "Could not set transient hostname: %m");