From da927ba997d68401563b927f92e6e40e021a8e5c Mon Sep 17 00:00:00 2001 From: Michal Schmidt Date: Fri, 28 Nov 2014 13:19:16 +0100 Subject: treewide: no need to negate errno for log_*_errno() It corrrectly handles both positive and negative errno values. --- src/hostname/hostnamectl.c | 2 +- src/hostname/hostnamed.c | 22 +++++++++++----------- 2 files changed, 12 insertions(+), 12 deletions(-) (limited to 'src/hostname') diff --git a/src/hostname/hostnamectl.c b/src/hostname/hostnamectl.c index abbd787d2b..1026e195dc 100644 --- a/src/hostname/hostnamectl.c +++ b/src/hostname/hostnamectl.c @@ -529,7 +529,7 @@ int main(int argc, char *argv[]) { r = bus_open_transport(arg_transport, arg_host, false, &bus); if (r < 0) { - log_error_errno(-r, "Failed to create bus connection: %m"); + log_error_errno(r, "Failed to create bus connection: %m"); goto finish; } diff --git a/src/hostname/hostnamed.c b/src/hostname/hostnamed.c index edd5c8da37..f04925288a 100644 --- a/src/hostname/hostnamed.c +++ b/src/hostname/hostnamed.c @@ -442,7 +442,7 @@ static int method_set_hostname(sd_bus *bus, sd_bus_message *m, void *userdata, s 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)); } @@ -494,13 +494,13 @@ static int method_set_static_hostname(sd_bus *bus, sd_bus_message *m, void *user 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)); } @@ -573,7 +573,7 @@ static int set_machine_info(Context *c, sd_bus *bus, sd_bus_message *m, int prop 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)); } @@ -646,25 +646,25 @@ static int connect_bus(Context *c, sd_event *event, sd_bus **_bus) { r = sd_bus_default_system(&bus); if (r < 0) { - log_error_errno(-r, "Failed to get system bus connection: %m"); + log_error_errno(r, "Failed to get system bus connection: %m"); return r; } 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"); + log_error_errno(r, "Failed to register object: %m"); return r; } r = sd_bus_request_name(bus, "org.freedesktop.hostname1", 0); if (r < 0) { - log_error_errno(-r, "Failed to register name: %m"); + log_error_errno(r, "Failed to register name: %m"); return r; } r = sd_bus_attach_event(bus, event, 0); if (r < 0) { - log_error_errno(-r, "Failed to attach bus to event loop: %m"); + log_error_errno(r, "Failed to attach bus to event loop: %m"); return r; } @@ -701,7 +701,7 @@ int main(int argc, char *argv[]) { 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; } @@ -713,13 +713,13 @@ int main(int argc, char *argv[]) { 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; } -- cgit v1.2.3-54-g00ecf