Skip to content

Commit

Permalink
commands: switch api to new callback system
Browse files Browse the repository at this point in the history
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
  • Loading branch information
Christian Brauner authored and stgraber committed Jul 16, 2017
1 parent ba68fec commit 1c28f23
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/lxc/commands.c
Expand Up @@ -534,14 +534,18 @@ static int lxc_cmd_get_config_item_callback(int fd, struct lxc_cmd_req *req,
int cilen;
struct lxc_cmd_rsp rsp;
char *cidata;
struct lxc_config_t *item;

memset(&rsp, 0, sizeof(rsp));
cilen = lxc_get_config_item(handler->conf, req->data, NULL, 0);
item = lxc_getconfig(req->data);
if (!item)
goto err1;
cilen = item->get(req->data, NULL, 0, handler->conf);
if (cilen <= 0)
goto err1;

cidata = alloca(cilen + 1);
if (lxc_get_config_item(handler->conf, req->data, cidata, cilen + 1) != cilen)
if (item->get(req->data, cidata, cilen + 1, handler->conf) != cilen)
goto err1;
cidata[cilen] = '\0';
rsp.data = cidata;
Expand Down

0 comments on commit 1c28f23

Please sign in to comment.