r = context_update_kernel_hostname(c);
if (r < 0) {
- log_error_errno(-r, "Failed to set host name: %m");
+ log_error_errno(r, "Failed to set host name: %m");
return sd_bus_error_set_errnof(error, r, "Failed to set hostname: %s", strerror(-r));
}
r = context_update_kernel_hostname(c);
if (r < 0) {
- log_error_errno(-r, "Failed to set host name: %m");
+ log_error_errno(r, "Failed to set host name: %m");
return sd_bus_error_set_errnof(error, r, "Failed to set hostname: %s", strerror(-r));
}
r = context_write_data_static_hostname(c);
if (r < 0) {
- log_error_errno(-r, "Failed to write static host name: %m");
+ log_error_errno(r, "Failed to write static host name: %m");
return sd_bus_error_set_errnof(error, r, "Failed to set static hostname: %s", strerror(-r));
}
r = context_write_data_machine_info(c);
if (r < 0) {
- log_error_errno(-r, "Failed to write machine info: %m");
+ log_error_errno(r, "Failed to write machine info: %m");
return sd_bus_error_set_errnof(error, r, "Failed to write machine info: %s", strerror(-r));
}
assert(_bus);
r = sd_bus_default_system(&bus);
- if (r < 0) {
- log_error_errno(-r, "Failed to get system bus connection: %m");
- return r;
- }
+ if (r < 0)
+ return log_error_errno(r, "Failed to get system bus connection: %m");
r = sd_bus_add_object_vtable(bus, NULL, "/org/freedesktop/hostname1", "org.freedesktop.hostname1", hostname_vtable, c);
- if (r < 0) {
- log_error_errno(-r, "Failed to register object: %m");
- return r;
- }
+ if (r < 0)
+ return log_error_errno(r, "Failed to register object: %m");
r = sd_bus_request_name(bus, "org.freedesktop.hostname1", 0);
- if (r < 0) {
- log_error_errno(-r, "Failed to register name: %m");
- return r;
- }
+ if (r < 0)
+ return log_error_errno(r, "Failed to register name: %m");
r = sd_bus_attach_event(bus, event, 0);
- if (r < 0) {
- log_error_errno(-r, "Failed to attach bus to event loop: %m");
- return r;
- }
+ if (r < 0)
+ return log_error_errno(r, "Failed to attach bus to event loop: %m");
*_bus = bus;
bus = NULL;
r = sd_event_default(&event);
if (r < 0) {
- log_error_errno(-r, "Failed to allocate event loop: %m");
+ log_error_errno(r, "Failed to allocate event loop: %m");
goto finish;
}
r = context_read_data(&context);
if (r < 0) {
- log_error_errno(-r, "Failed to read hostname and machine information: %m");
+ log_error_errno(r, "Failed to read hostname and machine information: %m");
goto finish;
}
r = bus_event_loop_with_idle(event, bus, "org.freedesktop.hostname1", DEFAULT_EXIT_USEC, NULL, NULL);
if (r < 0) {
- log_error_errno(-r, "Failed to run event loop: %m");
+ log_error_errno(r, "Failed to run event loop: %m");
goto finish;
}