]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
commands: port lxc_cmd_get_config_item() to new helpers
authorChristian Brauner <christian.brauner@ubuntu.com>
Thu, 25 Feb 2021 09:20:33 +0000 (10:20 +0100)
committerChristian Brauner <christian.brauner@ubuntu.com>
Thu, 25 Feb 2021 11:03:26 +0000 (12:03 +0100)
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
src/lxc/commands.c

index e52d01c522ea17efd8339a3b571cec9f208ab9ee..98771376a03ead03c7583cceff24a816dfcc4ec8 100644 (file)
@@ -922,13 +922,14 @@ char *lxc_cmd_get_config_item(const char *name, const char *item,
                              const char *lxcpath)
 {
        bool stopped = false;
-       struct lxc_cmd_rr cmd = {
-               .req = { .cmd = LXC_CMD_GET_CONFIG_ITEM,
-                        .data = item,
-                        .datalen = strlen(item) + 1,
-                      },
-       };
        int ret;
+       struct lxc_cmd_rr cmd;
+
+       if (is_empty_string(item))
+               return NULL;
+
+       lxc_cmd_init(&cmd, LXC_CMD_GET_CONFIG_ITEM);
+       lxc_cmd_data(&cmd, strlen(item) + 1, item);
 
        ret = lxc_cmd(name, &cmd, &stopped, lxcpath, NULL);
        if (ret < 0)