summaryrefslogtreecommitdiff
path: root/src/cli_val_engine.c
diff options
context:
space:
mode:
authorAn-Cheng Huang <ancheng@vyatta.com>2007-11-09 16:56:20 -0800
committerAn-Cheng Huang <ancheng@vyatta.com>2007-11-09 16:56:20 -0800
commit646112e4e6e4d4ab36c61cba47e71c0a58322637 (patch)
tree48609671afccc5021a97206b8744950ee174ada3 /src/cli_val_engine.c
parent909d3e2eb34283300016f0671b213d2d756111cf (diff)
downloadvyatta-cfg-646112e4e6e4d4ab36c61cba47e71c0a58322637.tar.gz
vyatta-cfg-646112e4e6e4d4ab36c61cba47e71c0a58322637.zip
* fix for bug 2472: return empty string when directory references don't
exist (for existence checks in templates). * add debug output.
Diffstat (limited to 'src/cli_val_engine.c')
-rw-r--r--src/cli_val_engine.c22
1 files changed, 21 insertions, 1 deletions
diff --git a/src/cli_val_engine.c b/src/cli_val_engine.c
index fddad4c..50a02df 100644
--- a/src/cli_val_engine.c
+++ b/src/cli_val_engine.c
@@ -125,6 +125,10 @@ static char** clind_get_current_value(clind_path_ref cfg_path,
int value_ref = 0;
*ret_size=0;
+ DPRINT("get_current_value cfg[%s] tmpl[%s] chkexist=%d\n",
+ clind_path_get_path_string(cfg_path),
+ clind_path_get_path_string(tmpl_path),
+ check_existence);
if(val_type) *val_type=TEXT_TYPE;
if(cfg_path && (clind_path_get_size(cfg_path)>0)) {
@@ -213,7 +217,14 @@ static char** clind_get_current_value(clind_path_ref cfg_path,
ret=(char**)realloc(ret,sizeof(char*)*1);
ret[0]=clind_unescape(cfg_end);
*ret_size=1;
- }
+ } else {
+ /* we are checking existence, and it doesn't exist */
+ /* return empty string */
+ ret = (char**) realloc(ret, (sizeof(char *) * 1));
+ ret[0] = malloc(1);
+ ret[0][0] = 0;
+ *ret_size = 1;
+ }
}
if(ret) {
@@ -357,6 +368,9 @@ static clind_path_ref* clind_config_engine_apply_command(clind_path_ref cfg_path
int *result_len) {
clind_path_ref* ret=NULL;
+ DPRINT("eng_apply_cmd cfg=[%s] tmpl=[%s] type=%d\n",
+ clind_path_get_path_string(cfg_path),
+ clind_path_get_path_string(tmpl_path), cmd->type);
if(cfg_path && tmpl_path && result_len && cmd) {
/*
@@ -595,6 +609,12 @@ int clind_config_engine_apply_command_path(clind_path_ref cfg_path_orig,
clind_path_get_path_string(cmd_path),
root_tmpl_path);
*/
+ DPRINT("eng_apply_cmd_path cfg=[%s] tmpl=[%s] cmd=[%s] "
+ "rcfg=[%s] rtmpl=[%s]\n",
+ clind_path_get_path_string(cfg_path_orig),
+ clind_path_get_path_string(tmpl_path_orig),
+ clind_path_get_path_string(cmd_path),
+ root_cfg_path, root_tmpl_path);
if(cfg_path_orig && tmpl_path_orig && cmd_path && res) {