hostnamectl: convert more hostname1 calls to BusLocator
This commit is contained in:
@@ -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));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user