From 70b770923b6a4ea17a3ca0c6acebc0558d7de035 Mon Sep 17 00:00:00 2001 From: Nalin Dahyabhai Date: Nov 12 2009 19:23:55 +0000 Subject: - walk the list of states correctly --- diff --git a/tests/tools/iterate.c b/tests/tools/iterate.c index 48dffdd..1a01847 100644 --- a/tests/tools/iterate.c +++ b/tests/tools/iterate.c @@ -50,7 +50,7 @@ struct cm_context { static struct cm_store_ca * get_ca_by_index(struct cm_context *cm, int i) { - if (i != 0) { + if (i == 0) { return cm->ca; } else { return NULL; @@ -106,9 +106,9 @@ main(int argc, char **argv) while (cm_iterate(entry, ca.ca, &ca, get_ca_by_index, get_n_cas, istate, &when, &delay, &readfd) == 0) { /* Check if this state is in our continue-states list. */ - for (p = states; *p != '\0'; p = p + strcspn(p, ",")) { + for (p = states; *p != '\0'; p = q + strspn(q, ",")) { q = p + strcspn(p, ","); - tmp = talloc_strndup(states, p, q - p); + tmp = talloc_strndup(parent, p, q - p); if (entry->cm_state == cm_store_state_from_string(tmp)) { printf("%s\n", tmp);