From dd6376bbd15a0d124003d1b1f0ac51410704b445 Mon Sep 17 00:00:00 2001 From: Theodore Tso Date: Mon, 8 Mar 1999 19:45:10 +0000 Subject: [PATCH] * prof_tree.c (profile_node_iterator): Fix bug where it will loop endlessly when searching an empty section. * test_profile.c: Add code so that the "add" code will interpret "NULL" as calling profile_add_relation with a null pointer for the value. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@11245 dc483132-0cff-0310-8789-dd5450dbe970 --- src/util/profile/ChangeLog | 9 +++++++++ src/util/profile/prof_tree.c | 4 ++-- src/util/profile/test_profile.c | 5 ++++- 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/src/util/profile/ChangeLog b/src/util/profile/ChangeLog index 835a00b59..bd0dc6199 100644 --- a/src/util/profile/ChangeLog +++ b/src/util/profile/ChangeLog @@ -1,3 +1,12 @@ +Mon Mar 8 14:38:24 1999 Theodore Y. Ts'o + + * prof_tree.c (profile_node_iterator): Fix bug where it will loop + endlessly when searching an empty section. + + * test_profile.c: Add code so that the "add" code will interpret + "NULL" as calling profile_add_relation with a null pointer + for the value. + Wed Mar 3 18:23:47 1999 Theodore Y. Ts'o * prof_file.c (profile_flush_file): On the Macintosh, fopen() diff --git a/src/util/profile/prof_tree.c b/src/util/profile/prof_tree.c index 47160906a..77018bba7 100644 --- a/src/util/profile/prof_tree.c +++ b/src/util/profile/prof_tree.c @@ -476,7 +476,7 @@ errcode_t profile_node_iterator(iter_p, ret_node, ret_name, ret_value) iter->node = 0; } get_new_file: - while (iter->node == 0) { + if (iter->node == 0) { if (iter->file == 0 || (iter->flags & PROFILE_ITER_FINAL_SEEN)) { profile_node_iterator_free(iter_p); @@ -513,7 +513,7 @@ get_new_file: if (!section) { iter->file = iter->file->next; skip_num = 0; - continue; + goto get_new_file; } iter->name = *cpp; iter->node = section->first_child; diff --git a/src/util/profile/test_profile.c b/src/util/profile/test_profile.c index a36b778bc..da81a20e0 100644 --- a/src/util/profile/test_profile.c +++ b/src/util/profile/test_profile.c @@ -83,8 +83,11 @@ static void do_batchmode(profile) retval = profile_rename_section(profile, names+1, *names); } else if (!strcmp(cmd, "add")) { + value = *names; + if (strcmp(value, "NULL") == 0) + value = NULL; retval = profile_add_relation(profile, names+1, - *names); + value); } else if (!strcmp(cmd, "flush")) { retval = profile_flush(profile); } else { -- 2.26.2