summaryrefslogtreecommitdiffstats
path: root/src/client.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/client.c')
-rw-r--r--src/client.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/client.c b/src/client.c
index 46baab8..3affaed 100644
--- a/src/client.c
+++ b/src/client.c
@@ -171,7 +171,7 @@ static int og_resp_probe(struct og_client *cli, json_t *data)
static int og_resp_shell_run(struct og_client *cli, json_t *data)
{
- const char *output = NULL;
+ const char *cmd = NULL, *output = NULL;
uint32_t retcode;
const char *key;
json_t *value;
@@ -181,7 +181,11 @@ static int og_resp_shell_run(struct og_client *cli, json_t *data)
return -1;
json_object_foreach(data, key, value) {
- if (!strcmp(key, "out")) {
+ if (!strcmp(key, "cmd")) {
+ err = og_json_parse_string(value, &cmd);
+ if (err < 0)
+ return err;
+ } else if (!strcmp(key, "out")) {
err = og_json_parse_string(value, &output);
if (err < 0)
return err;
@@ -199,7 +203,9 @@ static int og_resp_shell_run(struct og_client *cli, json_t *data)
return -1;
}
+ free((void *)cli->shell.cmd);
free((void *)cli->shell.output);
+ cli->shell.cmd = strdup(cmd);
cli->shell.output = strdup(output);
cli->shell.retcode = retcode;