minor: strncpy -> strcpy and formatting

This commit is contained in:
Olof hagsand 2020-10-10 15:32:19 +02:00
parent f8ac8cc14b
commit f9cc26582a
3 changed files with 8 additions and 4 deletions

View file

@ -415,7 +415,7 @@ usage(clicon_handle h,
"\t-1\t\tRun once and then quit (dont wait for events)\n" "\t-1\t\tRun once and then quit (dont wait for events)\n"
"\t-s <mode>\tSpecify backend startup mode: none|startup|running|init)\n" "\t-s <mode>\tSpecify backend startup mode: none|startup|running|init)\n"
"\t-c <file>\tLoad extra xml configuration, but don't commit.\n" "\t-c <file>\tLoad extra xml configuration, but don't commit.\n"
"\t-q \tQuit startup directly after upgrading and print result on stdout\n" "\t-q \t\tQuit startup directly after upgrading and print result on stdout\n"
"\t-U <user>\tRun backend daemon as this user AND drop privileges permanently\n" "\t-U <user>\tRun backend daemon as this user AND drop privileges permanently\n"
"\t-g <group>\tClient membership required to this group (default: %s)\n" "\t-g <group>\tClient membership required to this group (default: %s)\n"

View file

@ -107,7 +107,7 @@ clicon_strsep(char *string,
} }
memset(vec, 0, siz); memset(vec, 0, siz);
ptr = (char*)vec + (nvec+1)* sizeof(char*); /* this is where ptr starts */ ptr = (char*)vec + (nvec+1)* sizeof(char*); /* this is where ptr starts */
strncpy(ptr, string, strlen(string)+1); strcpy(ptr, string);
i = 0; i = 0;
while ((p = strsep(&ptr, delim)) != NULL) while ((p = strsep(&ptr, delim)) != NULL)
vec[i++] = p; vec[i++] = p;

View file

@ -218,8 +218,9 @@ xp_primary_function(clixon_xpath_yacc *xpy,
xpath_tree *xtret = NULL; xpath_tree *xtret = NULL;
enum clixon_xpath_function fn; enum clixon_xpath_function fn;
cbuf *cb = NULL; cbuf *cb = NULL;
int ret;
if ((fn = xp_fnname_str2int(name)) < 0){ if ((ret = xp_fnname_str2int(name)) < 0){
if ((cb = cbuf_new()) == NULL){ if ((cb = cbuf_new()) == NULL){
clicon_err(OE_XML, errno, "cbuf_new"); clicon_err(OE_XML, errno, "cbuf_new");
goto done; goto done;
@ -228,6 +229,7 @@ xp_primary_function(clixon_xpath_yacc *xpy,
clixon_xpath_parseerror(xpy, cbuf_get(cb)); clixon_xpath_parseerror(xpy, cbuf_get(cb));
goto done; goto done;
} }
fn = ret;
switch (fn){ switch (fn){
case XPATHFN_RE_MATCH: /* Group of NOT IMPLEMENTED xpath functions */ case XPATHFN_RE_MATCH: /* Group of NOT IMPLEMENTED xpath functions */
case XPATHFN_ENUM_VALUE: case XPATHFN_ENUM_VALUE:
@ -309,8 +311,9 @@ xp_nodetest_function(clixon_xpath_yacc *xpy,
xpath_tree *xtret = NULL; xpath_tree *xtret = NULL;
enum clixon_xpath_function fn; enum clixon_xpath_function fn;
cbuf *cb = NULL; cbuf *cb = NULL;
int ret;
if ((fn = xp_fnname_str2int(name)) < 0){ if ((ret = xp_fnname_str2int(name)) < 0){
if ((cb = cbuf_new()) == NULL){ if ((cb = cbuf_new()) == NULL){
clicon_err(OE_XML, errno, "cbuf_new"); clicon_err(OE_XML, errno, "cbuf_new");
goto done; goto done;
@ -319,6 +322,7 @@ xp_nodetest_function(clixon_xpath_yacc *xpy,
clixon_xpath_parseerror(xpy, cbuf_get(cb)); clixon_xpath_parseerror(xpy, cbuf_get(cb));
goto done; goto done;
} }
fn = ret;
switch (fn){ switch (fn){
case XPATHFN_COMMENT: /* Group of not implemented node functions */ case XPATHFN_COMMENT: /* Group of not implemented node functions */
case XPATHFN_PROCESSING_INSTRUCTIONS: case XPATHFN_PROCESSING_INSTRUCTIONS: