summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorTheodore Tso <tytso@mit.edu>1999-02-19 05:56:39 +0000
committerTheodore Tso <tytso@mit.edu>1999-02-19 05:56:39 +0000
commitdc768f82c1072791c4d5ad86ebfb3717270b1f17 (patch)
tree5bb67afe3aa2f378e049567f45853993c154b463 /src
parentf03cdc66b1a883d163b108406d7868ebadd1f59f (diff)
test_parse.c (main): Add a call to profile_verify_node so we can test
the internal rep invariants. prof_tree.c (profile_verify_node): Fix bug in profile_verify_node in the group_level test. Also make profile_verify_node check the return code when it is recursively testing the child nodes. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@11189 dc483132-0cff-0310-8789-dd5450dbe970
Diffstat (limited to 'src')
-rw-r--r--src/util/profile/ChangeLog10
-rw-r--r--src/util/profile/prof_tree.c9
-rw-r--r--src/util/profile/test_parse.c9
3 files changed, 24 insertions, 4 deletions
diff --git a/src/util/profile/ChangeLog b/src/util/profile/ChangeLog
index 2d764879f..db27227cc 100644
--- a/src/util/profile/ChangeLog
+++ b/src/util/profile/ChangeLog
@@ -1,3 +1,13 @@
+Fri Feb 19 00:49:10 1999 Theodore Y. Ts'o <tytso@mit.edu>
+
+ * test_parse.c (main): Add a call to profile_verify_node so we can
+ test the internal rep invariants.
+
+ * prof_tree.c (profile_verify_node): Fix bug in
+ profile_verify_node in the group_level test. Also make
+ profile_verify_node check the return code when it is
+ recursively testing the child nodes.
+
Mon Jan 25 18:44:26 1999 Theodore Y. Ts'o <tytso@mit.edu>
* prof_tree.c (profile_node_iterator): Added comments indicating
diff --git a/src/util/profile/prof_tree.c b/src/util/profile/prof_tree.c
index 499296c74..a95ce213b 100644
--- a/src/util/profile/prof_tree.c
+++ b/src/util/profile/prof_tree.c
@@ -109,7 +109,8 @@ errcode_t profile_verify_node(node)
struct profile_node *node;
{
struct profile_node *p, *last;
-
+ errcode_t retval;
+
CHECK_MAGIC(node);
if (node->value && node->first_child)
@@ -121,11 +122,13 @@ errcode_t profile_verify_node(node)
return PROF_BAD_LINK_LIST;
if (last && (last->next != p))
return PROF_BAD_LINK_LIST;
- if (node->group_level != p->group_level+1)
+ if (node->group_level+1 != p->group_level)
return PROF_BAD_GROUP_LVL;
if (p->parent != node)
return PROF_BAD_PARENT_PTR;
- profile_verify_node(p);
+ retval = profile_verify_node(p);
+ if (retval)
+ return retval;
}
return 0;
}
diff --git a/src/util/profile/test_parse.c b/src/util/profile/test_parse.c
index accd04aa9..2f00d9e81 100644
--- a/src/util/profile/test_parse.c
+++ b/src/util/profile/test_parse.c
@@ -33,7 +33,7 @@ int main(argc, argv)
retval = profile_parse_file(f, &root);
if (retval) {
printf("profile_parse_file error %s\n", error_message(retval));
- return 0;
+ exit(1);
}
fclose(f);
@@ -44,6 +44,13 @@ int main(argc, argv)
dump_profile_to_file(root, 0, stdout);
#endif
+ retval = profile_verify_node(root);
+ if (retval) {
+ printf("profile_verify_node reported an error: %s\n",
+ error_message(retval));
+ exit(1);
+ }
+
profile_free_node(root);
return 0;