Fixed again: [backend start resconf failed due to path string truncated #192](https://github.com/clicon/clixon/issues/192)

This commit is contained in:
Olof hagsand 2021-03-24 12:23:00 +01:00
parent 709459304f
commit 477059f33d
13 changed files with 144 additions and 19 deletions

View file

@ -112,6 +112,7 @@ restconf_pseudo_process_control(clicon_handle h)
int i;
int nr;
cbuf *cb = NULL;
cbuf *cbdbg = NULL;
nr = 4;
if (clicon_debug_get() != 0)
@ -134,9 +135,12 @@ restconf_pseudo_process_control(clicon_handle h)
*/
if (clicon_debug_get() != 0){
argv[i++] = "-D";
cbuf_reset(cb);
cprintf(cb, "%d", clicon_debug_get());
argv[i++] = cbuf_get(cb);
if ((cbdbg = cbuf_new()) == NULL){ /* Cant use cb since it would overwrite it */
clicon_err(OE_UNIX, errno, "cbuf_new");
goto done;
}
cprintf(cbdbg, "%d", clicon_debug_get());
argv[i++] = cbuf_get(cbdbg);
}
argv[i++] = NULL;
assert(i==nr);
@ -152,6 +156,8 @@ restconf_pseudo_process_control(clicon_handle h)
done:
if (cb)
cbuf_free(cb);
if (cbdbg)
cbuf_free(cbdbg);
return retval;
}