diff options
author | Michael Larson <slioch@slioch.vyatta.com> | 2010-06-18 17:33:36 -0700 |
---|---|---|
committer | Michael Larson <slioch@slioch.vyatta.com> | 2010-06-18 17:33:36 -0700 |
commit | cb8966111497b66ad62972dcbd0047ae6f0db38d (patch) | |
tree | 98c4f751272a89109a5162b8645669b3a167080a /src/cli_val_engine.c | |
parent | c95b73e42b7cc229ef93ebf5f5ea372249f206de (diff) | |
download | vyatta-cfg-cb8966111497b66ad62972dcbd0047ae6f0db38d.tar.gz vyatta-cfg-cb8966111497b66ad62972dcbd0047ae6f0db38d.zip |
fix for bug 5701.
Diffstat (limited to 'src/cli_val_engine.c')
-rw-r--r-- | src/cli_val_engine.c | 62 |
1 files changed, 30 insertions, 32 deletions
diff --git a/src/cli_val_engine.c b/src/cli_val_engine.c index 3ac1735..377de76 100644 --- a/src/cli_val_engine.c +++ b/src/cli_val_engine.c @@ -181,38 +181,40 @@ static char** clind_get_current_value(clind_path_ref cfg_path, } else { - FILE* f = fopen(cfg_path_string,"r"); - if(f) { - char buffer[8193]; - if(multi_value) { - while(fgets(buffer, sizeof(buffer)-1,f)) { - int len=strlen(buffer); - while(len>0 && (buffer[len-1]==10 || buffer[len-1]==13)) { - buffer[len-1]=0; - len--; - } - if(len>0) { - ret=(char**)realloc(ret,sizeof(char*)*(*ret_size+1)); - ret[*ret_size]=strdup(buffer); - *ret_size+=1; + if (is_deactivated(&cfg_path) == FALSE) { + FILE* f = fopen(cfg_path_string,"r"); + if(f) { + char buffer[8193]; + if(multi_value) { + while(fgets(buffer, sizeof(buffer)-1,f)) { + int len=strlen(buffer); + while(len>0 && (buffer[len-1]==10 || buffer[len-1]==13)) { + buffer[len-1]=0; + len--; + } + if(len>0) { + ret=(char**)realloc(ret,sizeof(char*)*(*ret_size+1)); + ret[*ret_size]=strdup(buffer); + *ret_size+=1; + } } - } - } else { - int sz = fread(buffer, 1, sizeof(buffer)-1, f); - if(sz>0) { - int len=0; - buffer[sz]=0; - len=strlen(buffer); - while(len>0 && (buffer[len-1]==10 || buffer[len-1]==13)) { - buffer[len-1]=0; - len--; + } else { + int sz = fread(buffer, 1, sizeof(buffer)-1, f); + if(sz>0) { + int len=0; + buffer[sz]=0; + len=strlen(buffer); + while(len>0 && (buffer[len-1]==10 || buffer[len-1]==13)) { + buffer[len-1]=0; + len--; + } + ret=(char**)malloc(sizeof(char*)*1); + ret[0]=strdup(buffer); + *ret_size=1; } - ret=(char**)malloc(sizeof(char*)*1); - ret[0]=strdup(buffer); - *ret_size=1; } + fclose(f); } - fclose(f); } } @@ -599,10 +601,6 @@ static clind_path_ref* clind_config_engine_apply_command(clind_path_ref cfg_path } - if (is_deactivated(&cfg_path) == TRUE) { - return NULL; - } - return ret; } |