summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 947738e)
raw | patch | inline | side by side (parent: 947738e)
author | octo <octo> | |
Fri, 19 May 2006 14:47:06 +0000 (14:47 +0000) | ||
committer | octo <octo> | |
Fri, 19 May 2006 14:47:06 +0000 (14:47 +0000) |
src/liboping.c | patch | blob | history |
diff --git a/src/liboping.c b/src/liboping.c
index 2892bebd6eaaf275bb376f1848e90c4c6e65b20b..ea4fc741e530ab499e342a87ec60ec6117bf58cb 100644 (file)
--- a/src/liboping.c
+++ b/src/liboping.c
return (-1);
}
- ph->next = obj->head;
- obj->head = ph;
+ /*
+ * Adding in the front is much easier, but then the iterator will
+ * return the host that was added last as first host. That's just not
+ * nice. -octo
+ */
+ if (obj->head == NULL)
+ {
+ obj->head = ph;
+ }
+ else
+ {
+ pinghost_t *hptr;
+
+ hptr = obj->head;
+ while (hptr->next != NULL)
+ hptr = hptr->next;
+
+ assert ((hptr != NULL) && (hptr->next == NULL));
+ hptr->next = ph;
+ }
ping_set_ttl (ph, obj->ttl);