diff options
author | An-Cheng Huang <ancheng@vyatta.com> | 2011-04-08 10:47:45 -0700 |
---|---|---|
committer | An-Cheng Huang <ancheng@vyatta.com> | 2011-04-08 10:47:45 -0700 |
commit | 46facd0c7284b5ea97618e916747026156babf48 (patch) | |
tree | 74a3e46e33aeb9a828387bb13b6fa5d8aea335c2 /src | |
parent | fcdc4ad086945f8a947c2ede2f87bc8d549bcae0 (diff) | |
download | vyatta-cfg-46facd0c7284b5ea97618e916747026156babf48.tar.gz vyatta-cfg-46facd0c7284b5ea97618e916747026156babf48.zip |
fix for bug 6985
* rename needs to mark the new tag value "changed".
Diffstat (limited to 'src')
-rw-r--r-- | src/cstore/cstore.cpp | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/src/cstore/cstore.cpp b/src/cstore/cstore.cpp index 2fa7a9b..143e501 100644 --- a/src/cstore/cstore.cpp +++ b/src/cstore/cstore.cpp @@ -903,15 +903,20 @@ Cstore::renameCfgPath(const Cpath& args) const char *otagnode = args[0]; const char *otagval = args[1]; const char *ntagval = args[4]; + auto_ptr<SavePaths> save(create_save_paths()); push_cfg_path(otagnode); - /* also mark changed. note that it's marking the "tag node" but not the - * "tag values" since one is being "deleted" and the other is being - * "added" anyway. + if (!rename_child_node(otagval, ntagval)) { + return false; + } + /* also mark the new "tag value" changed since one possible scenario is that + * the "new" tag value was there before but is being deleted, and something + * else is being renamed to the same tag value. one side effect of this is + * that if the subtree under the new tag value is completely identical + * before and after this delete/rename sequence, then it will be marked + * "changed" even though nothing changed. */ - bool ret = (rename_child_node(otagval, ntagval) - && mark_changed_with_ancestors()); - pop_cfg_path(); - return ret; + push_cfg_path(ntagval); + return mark_changed_with_ancestors(); } /* perform copy in "working config" according to specified args. |