Misc sanity checks and documentation

This commit is contained in:
Olof hagsand 2022-04-19 09:24:40 +02:00
parent 6418e030ce
commit fa077839f0
4 changed files with 10 additions and 4 deletions

View file

@ -862,7 +862,7 @@ load_config_file(clicon_handle h,
} }
/* Open and parse local file into xml */ /* Open and parse local file into xml */
if ((fp = fopen(filename, "r")) == NULL){ if ((fp = fopen(filename, "r")) == NULL){
clicon_err(OE_UNIX, errno, "open(%s)", filename); clicon_err(OE_UNIX, errno, "fopen(%s)", filename);
goto done; goto done;
} }
switch (format){ switch (format){

View file

@ -89,6 +89,10 @@ clicon_files_recursive1(const char *dir,
int res = 0; int res = 0;
struct stat st; struct stat st;
if (dir == NULL){
clicon_err(OE_UNIX, EINVAL, "Requires dir != NULL");
goto done;
}
if ((dirp = opendir(dir)) != NULL) if ((dirp = opendir(dir)) != NULL)
while ((dent = readdir(dirp)) != NULL) { while ((dent = readdir(dirp)) != NULL) {
if (dent->d_type == DT_DIR) { if (dent->d_type == DT_DIR) {
@ -128,6 +132,8 @@ clicon_files_recursive1(const char *dir,
return retval; return retval;
} }
/*! Find files recursively according to a regexp
*/
int int
clicon_files_recursive(const char *dir, clicon_files_recursive(const char *dir,
const char *regexp, const char *regexp,

View file

@ -957,8 +957,8 @@ yang_parse_find_match(clicon_handle h,
if (dp) if (dp)
free(dp); free(dp);
} }
else if (strcmp(xml_name(xc), "CLICON_YANG_DIR") == 0){ else if (strcmp(xml_name(xc), "CLICON_YANG_DIR") == 0 &&
dir = xml_body(xc); (dir = xml_body(xc)) != NULL){
/* get all matching files in this directory recursively */ /* get all matching files in this directory recursively */
if ((cvv = cvec_new(0)) == NULL){ if ((cvv = cvec_new(0)) == NULL){
clicon_err(OE_UNIX, errno, "cvec_new"); clicon_err(OE_UNIX, errno, "cvec_new");

View file

@ -218,7 +218,7 @@ if [ ! -d $dir ]; then
mkdir $dir mkdir $dir
fi fi
# Default restconf configuration: http IPv4 # Default restconf configuration: IPv4
# Can be placed in clixon-config # Can be placed in clixon-config
# Note that https clause assumes there exists certs and keys in /etc/ssl,... # Note that https clause assumes there exists certs and keys in /etc/ssl,...
# Args: # Args: