diff options
author | Theodore Tso <tytso@mit.edu> | 1999-03-03 04:56:15 +0000 |
---|---|---|
committer | Theodore Tso <tytso@mit.edu> | 1999-03-03 04:56:15 +0000 |
commit | 04df12f7fcb6663231290cbba39f7d4d2db99d0c (patch) | |
tree | 7e64b9482fdb51b0f7d084c64254ab282de6051c /src/util/profile/prof_tree.c | |
parent | c04da8d90f3548ea66b5968e9a13fcc4a3f7c01f (diff) | |
download | krb5-04df12f7fcb6663231290cbba39f7d4d2db99d0c.tar.gz krb5-04df12f7fcb6663231290cbba39f7d4d2db99d0c.tar.xz krb5-04df12f7fcb6663231290cbba39f7d4d2db99d0c.zip |
test_profile.c: Added ability to test profile set functions, and in a
batch mode.
prof_init.c (profile_flush): Add new public function for flushing
changes made to the profile.
prof_parse.c (profile_write_tree_file): Add official internal function
for flushing out a profile tree to a FILE *.
configure.in, prof_file.c (rw_access): Add new function which checks
to see whether we have read/write access, and emulate this for losing
non-POSIX OS's.
prof_file.c (profile_flush_file): Add support for writing modified
profile file's. Call profile_flush_file from profile_close_file().
Also fixed minor bugs in prof_tree.c which affected renaming sections and
modifying existing relations.
git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@11237 dc483132-0cff-0310-8789-dd5450dbe970
Diffstat (limited to 'src/util/profile/prof_tree.c')
-rw-r--r-- | src/util/profile/prof_tree.c | 42 |
1 files changed, 24 insertions, 18 deletions
diff --git a/src/util/profile/prof_tree.c b/src/util/profile/prof_tree.c index 5fde5e930..47160906a 100644 --- a/src/util/profile/prof_tree.c +++ b/src/util/profile/prof_tree.c @@ -594,7 +594,7 @@ errcode_t profile_set_relation_value(node, new_value) CHECK_MAGIC(node); - if (node->value) + if (!node->value) return PROF_SET_SECTION_VALUE; cp = malloc(strlen(new_value)+1); @@ -644,25 +644,31 @@ errcode_t profile_rename_node(node, new_name) } /* - * OK, let's detach the node + * If we need to move the node, do it now. */ - if (node->prev) - node->prev->next = node->next; - else - node->parent->first_child = node->next; - - if (node->next) - node->next->prev = node->prev; + if ((p != node) && (last != node)) { + /* + * OK, let's detach the node + */ + if (node->prev) + node->prev->next = node->next; + else + node->parent->first_child = node->next; + if (node->next) + node->next->prev = node->prev; - /* - * Now let's reattach it in the right place. - */ - if (p) - p->prev = node; - if (last) - last->next = node; - else - node->parent->first_child = node; + /* + * Now let's reattach it in the right place. + */ + if (p) + p->prev = node; + if (last) + last->next = node; + else + node->parent->first_child = node; + node->next = p; + node->prev = last; + } free(node->name); node->name = new_string; |