summaryrefslogtreecommitdiff
path: root/src/commit.c
diff options
context:
space:
mode:
authorrbalocca <rbalocca@fugazi.vyatta.com>2007-12-18 14:18:24 -0800
committerrbalocca <rbalocca@fugazi.vyatta.com>2007-12-18 14:18:24 -0800
commit64a8cfa9effac219e51498c3b8ef43437ad0396a (patch)
treefb11fa4d01b3dbe1f0f60e838b4ec450cbf31a64 /src/commit.c
parent65db98116efa3c311c798f05f4f6ec97e9b6d643 (diff)
parent7966b8cf00e08548447e551a3fcfde40aa06cc59 (diff)
downloadvyatta-cfg-64a8cfa9effac219e51498c3b8ef43437ad0396a.tar.gz
vyatta-cfg-64a8cfa9effac219e51498c3b8ef43437ad0396a.zip
Merge branch 'master' into glendale
Diffstat (limited to 'src/commit.c')
-rw-r--r--src/commit.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/src/commit.c b/src/commit.c
index 400328e..c3219e5 100644
--- a/src/commit.c
+++ b/src/commit.c
@@ -157,6 +157,7 @@ static boolean validate_dir_for_commit()
cp = NULL;
status = get_value(&cp, &m_path);
if (status == VTWERR_OK) {
+ size_t value_size = 0;
#ifdef DEBUG1
printf("Validating value |%s|\n"
"for path %s\n", cp, m_path.path);
@@ -167,6 +168,7 @@ static boolean validate_dir_for_commit()
// Bug #2509
if (def.multi) {
char *old_value = NULL;
+ value_size = strlen(cp);
switch_path(APATH); // temporarily switching to the active config path
status = get_value(&old_value, &m_path);
if (status == VTWERR_OK) {
@@ -176,8 +178,10 @@ static boolean validate_dir_for_commit()
if (old_value)
my_free(old_value);
}
-
- status = validate_value(&def, cp);
+ if (strlen(cp) > 0 || value_size == 0)
+ status = validate_value(&def, cp);
+ else
+ status = TRUE;
ret = ret && status;
}
if (cp)
@@ -238,7 +242,7 @@ static boolean validate_dir_for_commit()
if (!def_present || !def.tag)
pop_path(&t_path); /* for PUSH 2b */
- }
+ } // while
status = closedir(dp);
if (status)
bye("Cannot close dir %s\n", m_path.path);
@@ -1334,8 +1338,8 @@ static int fin_commit(boolean ok)
static char format4[]="rm -rf %s/{.*,*} >&/dev/null ; /bin/true"; /*cdirp*/
static char format5[]="rm -rf %s/{.*,*} >&/dev/null ; /bin/true"; /*adirp*/
static char format6[]="mv -f %s/* -t %s";/*tmpp, adirp*/
- static char format7[]="sudo mount -t unionfs -o dirs=%s=rw:%s=ro"
- " unionfs %s"; /*cdirp, adirp, mdirp*/
+ static char format7[]="sudo mount -t $UNIONFS -o dirs=%s=rw:%s=ro"
+ " $UNIONFS %s"; /*cdirp, adirp, mdirp*/
int m_len = strlen(get_mdirp());
int t_len = strlen(get_tmpp());
int c_len = strlen(get_cdirp());