aboutsummaryrefslogtreecommitdiff
path: root/lib/llist.c
diff options
context:
space:
mode:
authorRob Landley <rob@landley.net>2012-11-22 21:18:09 -0600
committerRob Landley <rob@landley.net>2012-11-22 21:18:09 -0600
commitfe91e68e8d1e6a2974b57a9855032ad94d137e8e (patch)
treec6a347d54dae31c9572008133d6610df8c8dc475 /lib/llist.c
parentbd2e2279d2b8f491ff9a56f6bd9000b0215778f8 (diff)
downloadtoybox-fe91e68e8d1e6a2974b57a9855032ad94d137e8e.tar.gz
Remove readlink -m for being poorly defined ("readlink -m /dev/null/and/more" answers what question, exactly?), rewrite xabspath() to work right and not depend on realpath, fix subtle longstanding bug in llist_traverse().
Diffstat (limited to 'lib/llist.c')
-rw-r--r--lib/llist.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/llist.c b/lib/llist.c
index 9b6c2950..7b41fd08 100644
--- a/lib/llist.c
+++ b/lib/llist.c
@@ -8,12 +8,14 @@
// Call a function (such as free()) on each element of a linked list.
void llist_traverse(void *list, void (*using)(void *data))
{
+ void *old = list;
+
while (list) {
void *pop = llist_pop(&list);
using(pop);
// End doubly linked list too.
- if (list==pop) break;
+ if (old == list) break;
}
}