summaryrefslogtreecommitdiff
path: root/src/login
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2017-02-08 17:59:58 +0100
committerLennart Poettering <lennart@poettering.net>2017-02-09 16:13:07 +0100
commitf9e0eefc7cd0b9cbcdcaf7ba5d79a46d1b94b25a (patch)
treeae4eac72db37fe48202a9a1d7a622427e5987552 /src/login
parent4dae8ae6df4bc2469532db74bf906aebff527d9e (diff)
tree-wide: make bus_map_all_properties return a proper sd_bus_error
And then show it, to make things a bit friendlier to the user if we fail acquiring some props. In fact, this fixes a number of actual bugs, where we used an error structure for output that we actually never got an error in.
Diffstat (limited to 'src/login')
-rw-r--r--src/login/loginctl.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/src/login/loginctl.c b/src/login/loginctl.c
index 1aac7ae979..7dea5c0859 100644
--- a/src/login/loginctl.c
+++ b/src/login/loginctl.c
@@ -482,14 +482,15 @@ static int print_session_status_info(sd_bus *bus, const char *path, bool *new_li
{}
};
+ _cleanup_(sd_bus_error_free) sd_bus_error error = SD_BUS_ERROR_NULL;
char since1[FORMAT_TIMESTAMP_RELATIVE_MAX], *s1;
char since2[FORMAT_TIMESTAMP_MAX], *s2;
_cleanup_(session_status_info_clear) SessionStatusInfo i = {};
int r;
- r = bus_map_all_properties(bus, "org.freedesktop.login1", path, map, &i);
+ r = bus_map_all_properties(bus, "org.freedesktop.login1", path, map, &error, &i);
if (r < 0)
- return log_error_errno(r, "Could not get properties: %m");
+ return log_error_errno(r, "Could not get properties: %s", bus_error_message(&error, r));
if (*new_line)
printf("\n");
@@ -611,14 +612,15 @@ static int print_user_status_info(sd_bus *bus, const char *path, bool *new_line)
{}
};
+ _cleanup_(sd_bus_error_free) sd_bus_error error = SD_BUS_ERROR_NULL;
char since1[FORMAT_TIMESTAMP_RELATIVE_MAX], *s1;
char since2[FORMAT_TIMESTAMP_MAX], *s2;
_cleanup_(user_status_info_clear) UserStatusInfo i = {};
int r;
- r = bus_map_all_properties(bus, "org.freedesktop.login1", path, map, &i);
+ r = bus_map_all_properties(bus, "org.freedesktop.login1", path, map, &error, &i);
if (r < 0)
- return log_error_errno(r, "Could not get properties: %m");
+ return log_error_errno(r, "Could not get properties: %s", bus_error_message(&error, r));
if (*new_line)
printf("\n");
@@ -685,12 +687,13 @@ static int print_seat_status_info(sd_bus *bus, const char *path, bool *new_line)
{}
};
+ _cleanup_(sd_bus_error_free) sd_bus_error error = SD_BUS_ERROR_NULL;
_cleanup_(seat_status_info_clear) SeatStatusInfo i = {};
int r;
- r = bus_map_all_properties(bus, "org.freedesktop.login1", path, map, &i);
+ r = bus_map_all_properties(bus, "org.freedesktop.login1", path, map, &error, &i);
if (r < 0)
- return log_error_errno(r, "Could not get properties: %m");
+ return log_error_errno(r, "Could not get properties: %s", bus_error_message(&error, r));
if (*new_line)
printf("\n");