From: Christian Brauner Date: Thu, 25 Feb 2021 09:20:33 +0000 (+0100) Subject: commands: port lxc_cmd_get_config_item() to new helpers X-Git-Tag: lxc-5.0.0~267^2~25 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=187e46ab3216e670239ed1e2549cd3ea0bfd8ffd;p=thirdparty%2Flxc.git commands: port lxc_cmd_get_config_item() to new helpers Signed-off-by: Christian Brauner --- diff --git a/src/lxc/commands.c b/src/lxc/commands.c index e52d01c52..98771376a 100644 --- a/src/lxc/commands.c +++ b/src/lxc/commands.c @@ -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)