Fixed: [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-22 12:16:52 +01:00
parent 43db8dd5c5
commit 5ec8965d18
2 changed files with 13 additions and 6 deletions

View file

@ -70,6 +70,7 @@ Developers may need to change their code
### Corrected Bugs
* Fixed: [backend start resconf failed due to path string truncated #192](https://github.com/clicon/clixon/issues/192)
* Fixed: [state showing error in cli with CLICON_STREAM_DISCOVERY_RFC8040 #191](https://github.com/clicon/clixon/issues/191)
* Fixed: [yang submodule show error in modules-state #190](yang submodule show error in modules-state #190)
* Fixed: [Backend can not read datastore with container named "config" #147](https://github.com/clicon/clixon/issues/147)

View file

@ -111,8 +111,7 @@ restconf_pseudo_process_control(clicon_handle h)
char **argv = NULL;
int i;
int nr;
char dbgstr[8];
char wwwstr[64];
cbuf *cb = NULL;
nr = 4;
if (clicon_debug_get() != 0)
@ -122,8 +121,12 @@ restconf_pseudo_process_control(clicon_handle h)
goto done;
}
i = 0;
snprintf(wwwstr, sizeof(wwwstr)-1, "%s/clixon_restconf", clicon_option_str(h, "CLICON_WWWDIR"));
argv[i++] = wwwstr;
if ((cb = cbuf_new()) == NULL){
clicon_err(OE_UNIX, errno, "cbuf_new");
goto done;
}
cprintf(cb, "%s/clixon_restconf", clicon_option_str(h, "CLICON_WWWDIR"));
argv[i++] = cbuf_get(cb);
argv[i++] = "-f";
argv[i++] = clicon_option_str(h, "CLICON_CONFIGFILE");
/* Add debug if backend has debug.
@ -131,8 +134,9 @@ restconf_pseudo_process_control(clicon_handle h)
*/
if (clicon_debug_get() != 0){
argv[i++] = "-D";
snprintf(dbgstr, sizeof(dbgstr)-1, "%d", clicon_debug_get());
argv[i++] = dbgstr;
cbuf_reset(cb);
cprintf(cb, "%d", clicon_debug_get());
argv[i++] = cbuf_get(cb);
}
argv[i++] = NULL;
assert(i==nr);
@ -146,6 +150,8 @@ restconf_pseudo_process_control(clicon_handle h)
free(argv);
retval = 0;
done:
if (cb)
cbuf_free(cb);
return retval;
}