summaryrefslogtreecommitdiff
path: root/src/login
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2013-11-07 21:26:31 +0100
committerLennart Poettering <lennart@poettering.net>2013-11-07 21:26:31 +0100
commit5b30bef856e89a571df57b7b953e9a1409d9aced (patch)
tree815d8648bf7b59a35c1cda35174b8b1e08cac323 /src/login
parent46e65dcc3a522b5e992e165b5e61d14254026859 (diff)
bus: log message parsing errors everywhere with a generalized bus_log_parse_error()
Diffstat (limited to 'src/login')
-rw-r--r--src/login/inhibit.c2
-rw-r--r--src/login/loginctl.c23
2 files changed, 10 insertions, 15 deletions
diff --git a/src/login/inhibit.c b/src/login/inhibit.c
index 8c0056e503..e20af74ef0 100644
--- a/src/login/inhibit.c
+++ b/src/login/inhibit.c
@@ -62,7 +62,7 @@ static int inhibit(sd_bus *bus, sd_bus_error *error) {
r = sd_bus_message_read_basic(reply, SD_BUS_TYPE_UNIX_FD, &fd);
if (r < 0)
- return -EIO;
+ return r;
r = dup(fd);
if (r < 0)
diff --git a/src/login/loginctl.c b/src/login/loginctl.c
index c9899ecba5..2aedbcf922 100644
--- a/src/login/loginctl.c
+++ b/src/login/loginctl.c
@@ -72,11 +72,6 @@ static void polkit_agent_open_if_enabled(void) {
polkit_agent_open();
}
-static int log_parse_error(int r) {
- log_error("Failed to parse message: %s", strerror(-r));
- return r;
-}
-
static int list_sessions(sd_bus *bus, char **args, unsigned n) {
_cleanup_bus_error_free_ sd_bus_error error = SD_BUS_ERROR_NULL;
_cleanup_bus_message_unref_ sd_bus_message *reply = NULL;
@@ -102,7 +97,7 @@ static int list_sessions(sd_bus *bus, char **args, unsigned n) {
r = sd_bus_message_enter_container(reply, 'a', "(susso)");
if (r < 0)
- return log_parse_error(r);
+ return bus_log_parse_error(r);
printf("%10s %10s %-16s %-16s\n", "SESSION", "UID", "USER", "SEAT");
@@ -111,7 +106,7 @@ static int list_sessions(sd_bus *bus, char **args, unsigned n) {
k++;
}
if (r < 0)
- return log_parse_error(r);
+ return bus_log_parse_error(r);
printf("\n%u sessions listed.\n", k);
@@ -143,7 +138,7 @@ static int list_users(sd_bus *bus, char **args, unsigned n) {
r = sd_bus_message_enter_container(reply, 'a', "(uso)");
if (r < 0)
- return log_parse_error(r);
+ return bus_log_parse_error(r);
printf("%10s %-16s\n", "UID", "USER");
@@ -152,7 +147,7 @@ static int list_users(sd_bus *bus, char **args, unsigned n) {
k++;
}
if (r < 0)
- return log_parse_error(r);
+ return bus_log_parse_error(r);
printf("\n%u users listed.\n", k);
@@ -183,7 +178,7 @@ static int list_seats(sd_bus *bus, char **args, unsigned n) {
r = sd_bus_message_enter_container(reply, 'a', "(so)");
if (r < 0)
- return log_parse_error(r);
+ return bus_log_parse_error(r);
printf("%-16s\n", "SEAT");
@@ -192,7 +187,7 @@ static int list_seats(sd_bus *bus, char **args, unsigned n) {
k++;
}
if (r < 0)
- return log_parse_error(r);
+ return bus_log_parse_error(r);
printf("\n%u seats listed.\n", k);
@@ -622,7 +617,7 @@ static int show_session(sd_bus *bus, char **args, unsigned n) {
r = sd_bus_message_read(reply, "o", &path);
if (r < 0)
- return log_parse_error(r);
+ return bus_log_parse_error(r);
if (show_properties)
r = bus_print_all_properties(bus, "org.freedesktop.login1", path, NULL, arg_all);
@@ -689,7 +684,7 @@ static int show_user(sd_bus *bus, char **args, unsigned n) {
r = sd_bus_message_read(reply, "o", &path);
if (r < 0)
- return log_parse_error(r);
+ return bus_log_parse_error(r);
if (show_properties)
r = bus_print_all_properties(bus, "org.freedesktop.login1", path, NULL, arg_all);
@@ -749,7 +744,7 @@ static int show_seat(sd_bus *bus, char **args, unsigned n) {
r = sd_bus_message_read(reply, "o", &path);
if (r < 0)
- return log_parse_error(r);
+ return bus_log_parse_error(r);
if (show_properties)
r = bus_print_all_properties(bus, "org.freedesktop.login1", path, NULL, arg_all);