diff options
author | An-Cheng Huang <ancheng@vyatta.com> | 2007-11-01 11:39:27 -0700 |
---|---|---|
committer | An-Cheng Huang <ancheng@vyatta.com> | 2007-11-01 11:39:27 -0700 |
commit | 4e3a70dddcaa79909c13232be91a16be2262acfd (patch) | |
tree | 871eff634c197ed04cdc1ed1e5f875a407e63195 /src/set.c | |
parent | 45f0f4e2336f339ec0deefcd17a1892d0274e1e6 (diff) | |
download | vyatta-cfg-4e3a70dddcaa79909c13232be91a16be2262acfd.tar.gz vyatta-cfg-4e3a70dddcaa79909c13232be91a16be2262acfd.zip |
fix cli backend bug: syntax checking for leaf value nodes involving
variable references was not working.
Diffstat (limited to 'src/set.c')
-rw-r--r-- | src/set.c | 16 |
1 files changed, 12 insertions, 4 deletions
@@ -49,8 +49,14 @@ boolean set_validate(vtw_def *defp, char *valp, boolean empty_val) clind_path_destruct(&tp); } - pop_path(&t_path); /* it was tag or real value */ - + if (strcmp(path_end, TAG_NAME) == 0) { + /* it was a tag, so the def is at 1 level up */ + pop_path(&t_path); + } else { + /* it's actual value, so the tmpl path is fine */ + free(path_end); + path_end = NULL; + } } push_path(&t_path, DEF_NAME); if (lstat(t_path.path, &statbuf) < 0 || @@ -190,8 +196,10 @@ int main(int argc, char **argv) exit(1); } /*ai == argc -1, must be actual value */ - if (!empty_val) - pop_path(&m_path); /*it was value, not path segment */ + if (!empty_val) { + pop_path(&m_path); /* pop the actual value at the end */ + pop_path(&t_path); /* pop the "node.tag" */ + } if(!set_validate(&def, argv[argc-1], empty_val)) { exit(1); |