chiark / gitweb /
systemctl: check if iterator was initialized succesfully
[elogind.git] / src / systemctl / systemctl.c
index a2dbbe82cd05fffeed2f4b9bd000d6f22ce9d354..99286cfc75b61eeceec6d00f7c8244cfd3344aee 100644 (file)
@@ -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.");
@@ -5094,11 +5098,11 @@ static int systemctl_main(DBusConnection *bus, int argc, char *argv[], DBusError
                 { "condreload",            MORE,  2, start_unit        }, /* For compatibility with ALTLinux */
                 { "condrestart",           MORE,  2, start_unit        }, /* For compatibility with RH */
                 { "isolate",               EQUAL, 2, start_unit        },
-                { "set-cgroup",            MORE,  2, set_cgroup        },
-                { "unset-cgroup",          MORE,  2, set_cgroup        },
-                { "get-cgroup-attr",       MORE,  2, get_cgroup_attr   },
-                { "set-cgroup-attr",       MORE,  2, set_cgroup_attr   },
-                { "unset-cgroup-attr",     MORE,  2, set_cgroup        },
+                { "set-cgroup",            MORE,  3, set_cgroup        },
+                { "unset-cgroup",          MORE,  3, set_cgroup        },
+                { "get-cgroup-attr",       MORE,  3, get_cgroup_attr   },
+                { "set-cgroup-attr",       MORE,  4, set_cgroup_attr   },
+                { "unset-cgroup-attr",     MORE,  3, set_cgroup        },
                 { "kill",                  MORE,  2, kill_unit         },
                 { "is-active",             MORE,  2, check_unit_active },
                 { "check",                 MORE,  2, check_unit_active },