diff options
author | John Southworth <john.southworth@vyatta.com> | 2011-07-23 21:00:10 -0700 |
---|---|---|
committer | John Southworth <john.southworth@vyatta.com> | 2011-08-04 13:56:30 -0500 |
commit | b1b85b19d35871ca65058e23ee79706be99130af (patch) | |
tree | ef197694b6c9615b18f650fd6da002cc9050ec51 | |
parent | 64d54e8f44ef629516aa8e61b373572f8fad9666 (diff) | |
download | vyatta-cfg-b1b85b19d35871ca65058e23ee79706be99130af.tar.gz vyatta-cfg-b1b85b19d35871ca65058e23ee79706be99130af.zip |
Bugfix 7362: Make reset_paths reset to root level when resolving varrefs
-rw-r--r-- | src/cstore/cstore-varref.cpp | 2 | ||||
-rw-r--r-- | src/cstore/cstore.hpp | 2 | ||||
-rw-r--r-- | src/cstore/unionfs/cstore-unionfs.hpp | 12 |
3 files changed, 13 insertions, 3 deletions
diff --git a/src/cstore/cstore-varref.cpp b/src/cstore/cstore-varref.cpp index f4a6918..4ece3b0 100644 --- a/src/cstore/cstore-varref.cpp +++ b/src/cstore/cstore-varref.cpp @@ -47,7 +47,7 @@ Cstore::VarRef::VarRef(Cstore *cstore, const string& ref_str, bool active) _orig_path_comps.push(tmp.back()); tmp.pop_back(); } - _cstore->reset_paths(); + _cstore->reset_paths(true); /* at this point, cstore paths are at root. _orig_path_comps contains * the path originally in cstore (or empty if _absolute). */ diff --git a/src/cstore/cstore.hpp b/src/cstore/cstore.hpp index d6f6d67..228a6c3 100644 --- a/src/cstore/cstore.hpp +++ b/src/cstore/cstore.hpp @@ -339,7 +339,7 @@ private: virtual void pop_cfg_path() = 0; virtual void pop_cfg_path(string& last) = 0; virtual void append_cfg_path(const Cpath& path_comps) = 0; - virtual void reset_paths() = 0; + virtual void reset_paths(bool to_root = true) = 0; virtual auto_ptr<SavePaths> create_save_paths() = 0; virtual bool cfg_path_at_root() = 0; virtual bool tmpl_path_at_root() = 0; diff --git a/src/cstore/unionfs/cstore-unionfs.hpp b/src/cstore/unionfs/cstore-unionfs.hpp index 1240488..c56f060 100644 --- a/src/cstore/unionfs/cstore-unionfs.hpp +++ b/src/cstore/unionfs/cstore-unionfs.hpp @@ -154,7 +154,17 @@ private: push_cfg_path(path_comps[i]); } }; - void reset_paths() { + void reset_paths(bool to_root=false) { + if (to_root){ + char *val; + if ((val = getenv(C_ENV_TMPL_ROOT.c_str()))) { + tmpl_path = val; + } else { + tmpl_path = C_DEF_TMPL_ROOT; + } + orig_tmpl_path = val; + orig_mutable_cfg_path = "/"; + } tmpl_path = orig_tmpl_path; mutable_cfg_path = orig_mutable_cfg_path; }; |