summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMichael Larson <slioch@slioch.vyatta.com>2010-05-19 14:54:44 -0700
committerMichael Larson <slioch@slioch.vyatta.com>2010-05-19 14:54:44 -0700
commit846abdb265aa2673816fbf5f8e515c62d443a84b (patch)
tree01eee91070264e399b503f5aa8928583094cbaad /src
parent3d91d264f5961786f34494d30281de04504916c7 (diff)
downloadvyatta-cfg-846abdb265aa2673816fbf5f8e515c62d443a84b.tar.gz
vyatta-cfg-846abdb265aa2673816fbf5f8e515c62d443a84b.zip
modified tag limit == 1. Now when set this node will only allow a single instance. todo update the parsing structure to support a signed value to support embedded tag node
value of 1 (current behavior)--will address this in the future (or when this behavior is requested).
Diffstat (limited to 'src')
-rw-r--r--src/common/unionfs.c4
-rw-r--r--src/set.c9
2 files changed, 8 insertions, 5 deletions
diff --git a/src/common/unionfs.c b/src/common/unionfs.c
index 151c6ce..2f7cd70 100644
--- a/src/common/unionfs.c
+++ b/src/common/unionfs.c
@@ -227,10 +227,10 @@ retrieve_data(char* rel_data_path, GNode *node, char* root, NODE_OPERATION op)
//either multi or tag--shouldn't have made a difference, but arkady was confused.
vn->_config._multi = (def.tag | def.multi);
- if (def.def_tag > 0) {
+ if (def.def_tag != 0) {
vn->_config._limit = def.def_tag;
}
- else if (def.def_multi > 0) {
+ else if (def.def_multi != 0) {
vn->_config._limit = def.def_multi;
}
else {
diff --git a/src/set.c b/src/set.c
index 47db90c..180a8b0 100644
--- a/src/set.c
+++ b/src/set.c
@@ -93,7 +93,10 @@ boolean set_validate(vtw_def *defp, char *valp, boolean empty_val)
}
//apply limit count here, needs to be defined as a tag,multi and have a value set
- if ((defp->tag || defp->multi) && (defp->def_tag > 0 || defp->def_multi > 0)) {
+
+ //NOTE: changed behavior for def_tag==1. Needs signed 32 support in parser where -1
+ //represents embedded tag node... TODO
+ if ((defp->tag || defp->multi) && (defp->def_tag != 0 || defp->def_multi != 0)) {
//get count of siblings
char path[2048];
@@ -124,7 +127,7 @@ boolean set_validate(vtw_def *defp, char *valp, boolean empty_val)
}
closedir(dirp);
- if (defp->tag && file_count == 1 && defp->def_tag == 1) {
+ if (defp->tag && file_count == 1 && defp->def_tag < 0) {
//this is the special case, where the previous value should be deleted here...
char command[8192];
//let unionfs handle the diff
@@ -133,7 +136,7 @@ boolean set_validate(vtw_def *defp, char *valp, boolean empty_val)
}
if (defp->tag) {
- if (defp->def_tag > 1 && file_count >= defp->def_tag) {
+ if (defp->def_tag > 0 && file_count >= defp->def_tag) {
fprintf(out_stream,"Number of values exceeded for %s, allowed: %d, actual: %d\n",val,defp->def_tag,file_count);
return FALSE;
}