summaryrefslogtreecommitdiff
path: root/src/set.c
diff options
context:
space:
mode:
authorrbalocca <rbalocca@vyatta.com>2008-06-29 18:05:08 -0700
committerrbalocca <rbalocca@vyatta.com>2008-06-29 18:05:08 -0700
commit7db066e99a5e9c3b41ce30d19b9781b1a8df8d44 (patch)
tree75da49d74a9da7cb6df98651ef511ddd12a42790 /src/set.c
parentdd1921164c972be0333d8b90f7c12f31f67a136e (diff)
parent3b1043be67c60220c107e42998635c628eb84393 (diff)
downloadvyatta-cfg-7db066e99a5e9c3b41ce30d19b9781b1a8df8d44.tar.gz
vyatta-cfg-7db066e99a5e9c3b41ce30d19b9781b1a8df8d44.zip
Merge branch 'hollywood'
Diffstat (limited to 'src/set.c')
-rw-r--r--src/set.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/set.c b/src/set.c
index d961fb8..ed43267 100644
--- a/src/set.c
+++ b/src/set.c
@@ -245,6 +245,16 @@ int main(int argc, char **argv)
pop_path(&m_path);
}
make_dir();
+
+
+ if (!def.multi) {
+ char *path;
+ path= malloc(strlen(m_path.path)+5);
+ sprintf(path, "%s/def",m_path.path);
+ unlink(path);
+ free(path);
+ }
+
push_path(&m_path, VAL_NAME);
if(not_new && !def.multi) {
/* it is not multi and seen from M */
@@ -341,11 +351,22 @@ handle_default(vtw_path *mpath, vtw_path *tpath, char *exclude)
}
if (def.def_default) {
push_path(mpath, uename);
+
push_path(mpath, VAL_NAME);
if (lstat(mpath->path, &statbuf) < 0) {
/* no value. add the default */
pop_path(mpath);
touch_dir(mpath->path); /* make sure directory exist */
+
+ //create def marker
+ char *def_file;
+ def_file = malloc(strlen(mpath->path)+22);
+ sprintf(def_file,"touch %s/def",mpath->path);
+ system(def_file);
+ sprintf(def_file,"echo 'empty' > %s/def",mpath->path);
+ system(def_file);
+ free(def_file);
+
push_path(mpath, VAL_NAME);
fp = fopen(mpath->path, "w");
if (fp == NULL) {
@@ -356,6 +377,7 @@ handle_default(vtw_path *mpath, vtw_path *tpath, char *exclude)
bye("Error writing file %s", mpath->path);
}
fclose(fp);
+
}
pop_path(mpath); /* value */
pop_path(mpath); /* child */