summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2013-10-31 03:12:37 +0100
committerLennart Poettering <lennart@poettering.net>2013-10-31 03:14:37 +0100
commite1636421f46db6d06fbd028ef20a3113fa3e11f8 (patch)
treea35a334e660c8f495337ea8bf2530b7c4729ed7c
parent7f35b7bc4a241e9aa3b1512fd345cbf5b2e5a782 (diff)
localectl: always print error message when an operation fails
-rw-r--r--src/locale/localectl.c21
-rw-r--r--src/timedate/timedatectl.c4
2 files changed, 18 insertions, 7 deletions
diff --git a/src/locale/localectl.c b/src/locale/localectl.c
index 402b058e40..fe2af27a24 100644
--- a/src/locale/localectl.c
+++ b/src/locale/localectl.c
@@ -256,9 +256,8 @@ static int set_locale(sd_bus *bus, char **args, unsigned n) {
return r;
r = sd_bus_send_with_reply_and_block(bus, m, 0, &error, NULL);
-
if (r < 0) {
- log_error("Failed to issue method call: %s", strerror(-r));
+ log_error("Failed to issue method call: %s", bus_error_message(&error, -r));
return r;
}
@@ -460,6 +459,7 @@ static int set_vconsole_keymap(sd_bus *bus, char **args, unsigned n) {
_cleanup_bus_message_unref_ sd_bus_message *reply = NULL;
_cleanup_bus_error_free_ sd_bus_error error = SD_BUS_ERROR_NULL;
const char *map, *toggle_map;
+ int r;
assert(bus);
assert(args);
@@ -474,7 +474,8 @@ static int set_vconsole_keymap(sd_bus *bus, char **args, unsigned n) {
map = args[1];
toggle_map = n > 2 ? args[2] : "";
- return sd_bus_call_method(bus,
+ r = sd_bus_call_method(
+ bus,
"org.freedesktop.locale1",
"/org/freedesktop/locale1",
"org.freedesktop.locale1",
@@ -482,6 +483,10 @@ static int set_vconsole_keymap(sd_bus *bus, char **args, unsigned n) {
&error,
NULL,
"ssbb", map, toggle_map, arg_convert, arg_ask_password);
+ if (r < 0)
+ log_error("Failed to set keymap: %s", bus_error_message(&error, -r));
+
+ return r;
}
static Set *keymaps = NULL;
@@ -561,6 +566,7 @@ static int set_x11_keymap(sd_bus *bus, char **args, unsigned n) {
_cleanup_bus_message_unref_ sd_bus_message *reply = NULL;
_cleanup_bus_error_free_ sd_bus_error error = SD_BUS_ERROR_NULL;
const char *layout, *model, *variant, *options;
+ int r;
assert(bus);
assert(args);
@@ -577,7 +583,8 @@ static int set_x11_keymap(sd_bus *bus, char **args, unsigned n) {
variant = n > 3 ? args[3] : "";
options = n > 4 ? args[4] : "";
- return sd_bus_call_method(bus,
+ r = sd_bus_call_method(
+ bus,
"org.freedesktop.locale1",
"/org/freedesktop/locale1",
"org.freedesktop.locale1",
@@ -586,6 +593,10 @@ static int set_x11_keymap(sd_bus *bus, char **args, unsigned n) {
NULL,
"ssssbb", layout, model, variant, options,
arg_convert, arg_ask_password);
+ if (r < 0)
+ log_error("Failed to set keymap: %s", bus_error_message(&error, -r));
+
+ return r;
}
static int list_x11_keymaps(sd_bus *bus, char **args, unsigned n) {
@@ -701,7 +712,7 @@ static int help(void) {
" --no-pager Do not pipe output into a pager\n"
" --no-ask-password Do not prompt for password\n"
" -H --host=[USER@]HOST Operate on remote host\n"
- " -M --machine=CONTAINER Operate on local container\n\n"
+ " -M --machine=CONTAINER Operate on local container\n\n"
"Commands:\n"
" status Show current locale settings\n"
" set-locale LOCALE... Set system locale\n"
diff --git a/src/timedate/timedatectl.c b/src/timedate/timedatectl.c
index 48a3b49755..7054a02bcb 100644
--- a/src/timedate/timedatectl.c
+++ b/src/timedate/timedatectl.c
@@ -38,11 +38,11 @@
#include "pager.h"
#include "time-dst.h"
-static bool arg_adjust_system_clock = false;
static bool arg_no_pager = false;
-static BusTransport arg_transport = BUS_TRANSPORT_LOCAL;
static bool arg_ask_password = true;
+static BusTransport arg_transport = BUS_TRANSPORT_LOCAL;
static char *arg_host = NULL;
+static bool arg_adjust_system_clock = false;
static void pager_open_if_enabled(void) {