summaryrefslogtreecommitdiffstats
path: root/src/hostname/hostnamed.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/hostname/hostnamed.c')
-rw-r--r--src/hostname/hostnamed.c21
1 files changed, 7 insertions, 14 deletions
diff --git a/src/hostname/hostnamed.c b/src/hostname/hostnamed.c
index 8c0b63503f..d59c783dbc 100644
--- a/src/hostname/hostnamed.c
+++ b/src/hostname/hostnamed.c
@@ -663,8 +663,7 @@ static int property_get_static_hostname(
void *userdata,
sd_bus_error *error) {
- Context *c = userdata;
- assert(c);
+ Context *c = ASSERT_PTR(userdata);
context_read_etc_hostname(c);
@@ -730,8 +729,7 @@ static int property_get_hostname_source(
void *userdata,
sd_bus_error *error) {
- Context *c = userdata;
- assert(c);
+ Context *c = ASSERT_PTR(userdata);
context_read_etc_hostname(c);
context_determine_hostname_source(c);
@@ -851,12 +849,11 @@ static int property_get_uname_field(
}
static int method_set_hostname(sd_bus_message *m, void *userdata, sd_bus_error *error) {
- Context *c = userdata;
+ Context *c = ASSERT_PTR(userdata);
const char *name;
int interactive, r;
assert(m);
- assert(c);
r = sd_bus_message_read(m, "sb", &name, &interactive);
if (r < 0)
@@ -898,13 +895,12 @@ static int method_set_hostname(sd_bus_message *m, void *userdata, sd_bus_error *
}
static int method_set_static_hostname(sd_bus_message *m, void *userdata, sd_bus_error *error) {
- Context *c = userdata;
+ Context *c = ASSERT_PTR(userdata);
const char *name;
int interactive;
int r;
assert(m);
- assert(c);
r = sd_bus_message_read(m, "sb", &name, &interactive);
if (r < 0)
@@ -1068,12 +1064,11 @@ static int method_set_location(sd_bus_message *m, void *userdata, sd_bus_error *
static int method_get_product_uuid(sd_bus_message *m, void *userdata, sd_bus_error *error) {
_cleanup_(sd_bus_message_unrefp) sd_bus_message *reply = NULL;
- Context *c = userdata;
+ Context *c = ASSERT_PTR(userdata);
int interactive, r;
sd_id128_t uuid;
assert(m);
- assert(c);
r = sd_bus_message_read(m, "b", &interactive);
if (r < 0)
@@ -1119,11 +1114,10 @@ static int method_get_product_uuid(sd_bus_message *m, void *userdata, sd_bus_err
static int method_get_hardware_serial(sd_bus_message *m, void *userdata, sd_bus_error *error) {
_cleanup_(sd_bus_message_unrefp) sd_bus_message *reply = NULL;
_cleanup_free_ char *serial = NULL;
- Context *c = userdata;
+ Context *c = ASSERT_PTR(userdata);
int r;
assert(m);
- assert(c);
r = bus_verify_polkit_async(
m,
@@ -1160,13 +1154,12 @@ static int method_describe(sd_bus_message *m, void *userdata, sd_bus_error *erro
_cleanup_(sd_bus_message_unrefp) sd_bus_message *reply = NULL;
_cleanup_(json_variant_unrefp) JsonVariant *v = NULL;
sd_id128_t product_uuid = SD_ID128_NULL;
- Context *c = userdata;
+ Context *c = ASSERT_PTR(userdata);
bool privileged;
struct utsname u;
int r;
assert(m);
- assert(c);
r = bus_verify_polkit_async(
m,