mirror of
https://github.com/systemd/systemd-stable.git
synced 2025-01-25 06:03:40 +03:00
network: use bus_error_message()
This commit is contained in:
parent
0f82a2ab5c
commit
f63e09ef75
@ -3,6 +3,7 @@
|
|||||||
#include <netinet/in.h>
|
#include <netinet/in.h>
|
||||||
#include <linux/if_arp.h>
|
#include <linux/if_arp.h>
|
||||||
|
|
||||||
|
#include "bus-error.h"
|
||||||
#include "dhcp-internal.h"
|
#include "dhcp-internal.h"
|
||||||
#include "dhcp6-internal.h"
|
#include "dhcp6-internal.h"
|
||||||
#include "escape.h"
|
#include "escape.h"
|
||||||
@ -99,18 +100,20 @@ static int get_product_uuid_handler(sd_bus_message *m, void *userdata, sd_bus_er
|
|||||||
|
|
||||||
e = sd_bus_message_get_error(m);
|
e = sd_bus_message_get_error(m);
|
||||||
if (e) {
|
if (e) {
|
||||||
log_error_errno(sd_bus_error_get_errno(e),
|
r = sd_bus_error_get_errno(e);
|
||||||
"Could not get product UUID. Falling back to use machine-app-specific ID as DUID-UUID: %s",
|
log_warning_errno(r, "Could not get product UUID. Falling back to use machine-app-specific ID as DUID-UUID: %s",
|
||||||
e->message);
|
bus_error_message(e, r));
|
||||||
goto configure;
|
goto configure;
|
||||||
}
|
}
|
||||||
|
|
||||||
r = sd_bus_message_read_array(m, 'y', &a, &sz);
|
r = sd_bus_message_read_array(m, 'y', &a, &sz);
|
||||||
if (r < 0)
|
if (r < 0) {
|
||||||
|
log_warning_errno(r, "Failed to get product UUID. Falling back to use machine-app-specific ID as DUID-UUID: %m");
|
||||||
goto configure;
|
goto configure;
|
||||||
|
}
|
||||||
|
|
||||||
if (sz != sizeof(sd_id128_t)) {
|
if (sz != sizeof(sd_id128_t)) {
|
||||||
log_error("Invalid product UUID. Falling back to use machine-app-specific ID as DUID-UUID.");
|
log_warning("Invalid product UUID. Falling back to use machine-app-specific ID as DUID-UUID.");
|
||||||
goto configure;
|
goto configure;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -11,6 +11,7 @@
|
|||||||
#include "sd-netlink.h"
|
#include "sd-netlink.h"
|
||||||
|
|
||||||
#include "alloc-util.h"
|
#include "alloc-util.h"
|
||||||
|
#include "bus-error.h"
|
||||||
#include "bus-log-control-api.h"
|
#include "bus-log-control-api.h"
|
||||||
#include "bus-polkit.h"
|
#include "bus-polkit.h"
|
||||||
#include "bus-util.h"
|
#include "bus-util.h"
|
||||||
@ -1157,15 +1158,16 @@ void manager_dirty(Manager *manager) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int set_hostname_handler(sd_bus_message *m, void *userdata, sd_bus_error *ret_error) {
|
static int set_hostname_handler(sd_bus_message *m, void *userdata, sd_bus_error *ret_error) {
|
||||||
_unused_ Manager *manager = userdata;
|
|
||||||
const sd_bus_error *e;
|
const sd_bus_error *e;
|
||||||
|
int r;
|
||||||
|
|
||||||
assert(m);
|
assert(m);
|
||||||
assert(manager);
|
|
||||||
|
|
||||||
e = sd_bus_message_get_error(m);
|
e = sd_bus_message_get_error(m);
|
||||||
if (e)
|
if (e) {
|
||||||
log_warning_errno(sd_bus_error_get_errno(e), "Could not set hostname: %s", e->message);
|
r = sd_bus_error_get_errno(e);
|
||||||
|
log_warning_errno(r, "Could not set hostname: %s", bus_error_message(e, r));
|
||||||
|
}
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@ -1203,15 +1205,16 @@ int manager_set_hostname(Manager *m, const char *hostname) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int set_timezone_handler(sd_bus_message *m, void *userdata, sd_bus_error *ret_error) {
|
static int set_timezone_handler(sd_bus_message *m, void *userdata, sd_bus_error *ret_error) {
|
||||||
_unused_ Manager *manager = userdata;
|
|
||||||
const sd_bus_error *e;
|
const sd_bus_error *e;
|
||||||
|
int r;
|
||||||
|
|
||||||
assert(m);
|
assert(m);
|
||||||
assert(manager);
|
|
||||||
|
|
||||||
e = sd_bus_message_get_error(m);
|
e = sd_bus_message_get_error(m);
|
||||||
if (e)
|
if (e) {
|
||||||
log_warning_errno(sd_bus_error_get_errno(e), "Could not set timezone: %s", e->message);
|
r = sd_bus_error_get_errno(e);
|
||||||
|
log_warning_errno(r, "Could not set timezone: %s", bus_error_message(e, r));
|
||||||
|
}
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user