summaryrefslogtreecommitdiff
path: root/src/cstore/cstore-varref.cpp
diff options
context:
space:
mode:
authorAn-Cheng Huang <ancheng@vyatta.com>2011-05-17 10:20:19 -0700
committerAn-Cheng Huang <ancheng@vyatta.com>2011-05-17 10:20:19 -0700
commit9d5b213893a79939ac8f2e871e18ba3163eeab50 (patch)
tree6504ea1e8fc18436cedd4d378752b05d0c8c3e74 /src/cstore/cstore-varref.cpp
parent7a9ad37b1f598ec44ee01fc16ad16526e45f1bf7 (diff)
downloadvyatta-cfg-9d5b213893a79939ac8f2e871e18ba3163eeab50.tar.gz
vyatta-cfg-9d5b213893a79939ac8f2e871e18ba3163eeab50.zip
minor feature etc.
* add commit notification. * fix relative VAR references that traverse up to root level.
Diffstat (limited to 'src/cstore/cstore-varref.cpp')
-rw-r--r--src/cstore/cstore-varref.cpp23
1 files changed, 13 insertions, 10 deletions
diff --git a/src/cstore/cstore-varref.cpp b/src/cstore/cstore-varref.cpp
index 7549834..efe1b04 100644
--- a/src/cstore/cstore-varref.cpp
+++ b/src/cstore/cstore-varref.cpp
@@ -140,18 +140,21 @@ Cstore::VarRef::process_ref(const Cpath& ref_comps,
return;
}
pcomps.pop();
- def = _cstore->parseTmpl(pcomps, false);
- if (!def.get()) {
- // invalid tmpl path
- return;
- }
- if (def->isTagValue()) {
- // at "tag value", need to pop one more.
- if (pcomps.size() == 0) {
- // invalid path
+ if (pcomps.size() > 0) {
+ // not at root yet
+ def = _cstore->parseTmpl(pcomps, false);
+ if (!def.get()) {
+ // invalid tmpl path
return;
}
- pcomps.pop();
+ if (def->isTagValue()) {
+ // at "tag value", need to pop one more.
+ if (pcomps.size() == 0) {
+ // invalid path
+ return;
+ }
+ pcomps.pop();
+ }
}
process_ref(rcomps, pcomps, ERROR_TYPE);
} else if (cr_comp == "@@") {