chiark / gitweb /
pager: introduce "jump to end" option
[elogind.git] / src / systemctl / systemctl.c
index c67c6c972a1285567be791132dcf67414296209c..4a55c566eca136fe9b1fcc62199eb589b37aacb5 100644 (file)
@@ -136,7 +136,7 @@ static void pager_open_if_enabled(void) {
         if (arg_no_pager)
                 return;
 
-        pager_open();
+        pager_open(false);
 }
 
 static void ask_password_agent_open_if_enabled(void) {
@@ -2084,7 +2084,11 @@ static int get_cgroup_attr(DBusConnection *bus, char **args) {
                 if (r < 0)
                         return r;
 
-                dbus_message_iter_init(reply, &iter);
+                if (!dbus_message_iter_init(reply, &iter)) {
+                        log_error("Failed to initialize iterator.");
+                        return -EIO;
+                }
+
                 r = bus_parse_strv_iter(&iter, &list);
                 if (r < 0) {
                         log_error("Failed to parse value list.");
@@ -3978,6 +3982,7 @@ static int unit_is_enabled(DBusConnection *bus, char **args) {
         DBusMessage _cleanup_dbus_message_unref_ *reply = NULL;
         bool enabled;
         char **name;
+        char *n;
 
         dbus_error_init(&error);
 
@@ -3992,7 +3997,14 @@ static int unit_is_enabled(DBusConnection *bus, char **args) {
                 STRV_FOREACH(name, args+1) {
                         UnitFileState state;
 
-                        state = unit_file_get_state(arg_scope, arg_root, *name);
+                        n = unit_name_mangle(*name);
+                        if (!n)
+                                return log_oom();
+
+                        state = unit_file_get_state(arg_scope, arg_root, n);
+
+                        free(n);
+
                         if (state < 0)
                                 return state;
 
@@ -4009,6 +4021,10 @@ static int unit_is_enabled(DBusConnection *bus, char **args) {
                 STRV_FOREACH(name, args+1) {
                         const char *s;
 
+                        n = unit_name_mangle(*name);
+                        if (!n)
+                                return log_oom();
+
                         r = bus_method_call_with_reply (
                                         bus,
                                         "org.freedesktop.systemd1",
@@ -4017,8 +4033,11 @@ static int unit_is_enabled(DBusConnection *bus, char **args) {
                                         "GetUnitFileState",
                                         &reply,
                                         NULL,
-                                        DBUS_TYPE_STRING, name,
+                                        DBUS_TYPE_STRING, &n,
                                         DBUS_TYPE_INVALID);
+
+                        free(n);
+
                         if (r)
                                 return r;