summaryrefslogtreecommitdiffstats
path: root/src/hostname
diff options
context:
space:
mode:
authorDavid Tardon <dtardon@redhat.com>2023-05-23 20:40:47 +0200
committerDavid Tardon <dtardon@redhat.com>2023-05-24 08:33:22 +0200
commitd14bd34f2568ec9ceec4515dc59a175a6b8c4d54 (patch)
treed462c2eec2d413b718b0b54c4a414884fbe71eec /src/hostname
parenttree-wide: convert more resolve1.Manager calls to BusLocator (diff)
downloadsystemd-d14bd34f2568ec9ceec4515dc59a175a6b8c4d54.tar.xz
systemd-d14bd34f2568ec9ceec4515dc59a175a6b8c4d54.zip
hostnamectl: convert more hostname1 calls to BusLocator
Diffstat (limited to 'src/hostname')
-rw-r--r--src/hostname/hostnamectl.c28
1 files changed, 4 insertions, 24 deletions
diff --git a/src/hostname/hostnamectl.c b/src/hostname/hostnamectl.c
index a0e949d82c..8d3cca5c62 100644
--- a/src/hostname/hostnamectl.c
+++ b/src/hostname/hostnamectl.c
@@ -15,6 +15,7 @@
#include "build.h"
#include "bus-common-errors.h"
#include "bus-error.h"
+#include "bus-locator.h"
#include "bus-map-properties.h"
#include "format-table.h"
#include "hostname-setup.h"
@@ -298,13 +299,7 @@ static int get_one_name(sd_bus *bus, const char* attr, char **ret) {
/* This obtains one string property, and copy it if 'ret' is set, or print it otherwise. */
- r = sd_bus_get_property(
- bus,
- "org.freedesktop.hostname1",
- "/org/freedesktop/hostname1",
- "org.freedesktop.hostname1",
- attr,
- &error, &reply, "s");
+ r = bus_get_property(bus, bus_hostname, attr, &error, &reply, "s");
if (r < 0)
return log_error_errno(r, "Could not get property: %s", bus_error_message(&error, r));
@@ -408,15 +403,7 @@ static int show_status(int argc, char **argv, void *userdata) {
_cleanup_(json_variant_unrefp) JsonVariant *v = NULL;
const char *text = NULL;
- r = sd_bus_call_method(
- bus,
- "org.freedesktop.hostname1",
- "/org/freedesktop/hostname1",
- "org.freedesktop.hostname1",
- "Describe",
- &error,
- &reply,
- NULL);
+ r = bus_call_method(bus, bus_hostname, "Describe", &error, &reply, NULL);
if (r < 0)
return log_error_errno(r, "Could not get description: %s", bus_error_message(&error, r));
@@ -448,14 +435,7 @@ static int set_simple_string_internal(sd_bus *bus, sd_bus_error *error, const ch
if (!error)
error = &e;
- r = sd_bus_call_method(
- bus,
- "org.freedesktop.hostname1",
- "/org/freedesktop/hostname1",
- "org.freedesktop.hostname1",
- method,
- error, NULL,
- "sb", value, arg_ask_password);
+ r = bus_call_method(bus, bus_hostname, method, error, NULL, "sb", value, arg_ask_password);
if (r < 0)
return log_error_errno(r, "Could not set %s: %s", target, bus_error_message(error, r));