[systemd-devel] [PATCH 2/4] loginctl: add show_properties() to get login1 properties

Djalal Harouni tixxdz at opendz.org
Tue Dec 17 10:42:01 PST 2013


Commit f8f14b3654bcd introduced a regression that makes loginctl ignore
the "--property" option. Fix this in two patches.

This patch is just preparation, it introduces the show_properties()
function that will be used in the next patch to query properties.
---
 src/login/loginctl.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/src/login/loginctl.c b/src/login/loginctl.c
index e03b0b9..ce0c94b 100644
--- a/src/login/loginctl.c
+++ b/src/login/loginctl.c
@@ -572,6 +572,21 @@ finish:
         return 0;
 }
 
+static int show_properties(sd_bus *bus, const char *path, bool *new_line) {
+        int r;
+
+        if (*new_line)
+                printf("\n");
+
+        *new_line = true;
+
+        r = bus_print_all_properties(bus, "org.freedesktop.login1", path, arg_property, arg_all);
+        if (r < 0)
+                log_error("Could not get properties: %s", strerror(-r));
+
+        return r;
+}
+
 static int show_session(sd_bus *bus, char **args, unsigned n) {
         bool show_properties;
         unsigned i;
-- 
1.8.3.1



More information about the systemd-devel mailing list