From 772b89d34212e4b36c2025c80304e166bc25a2f3 Mon Sep 17 00:00:00 2001 From: Eric Sandeen Date: Fri, 20 Jun 2008 22:32:49 -0500 Subject: blkid: use list_for_each_safe in garbage collection We need to use list_for_each_safe in case a device gets removed from the list during garbage collection. Also make the manpage slightly more informative about what the -g garbage collection option does. Addresses-Debian-Bug: #487758, #487783 Signed-off-by: Eric Sandeen Signed-off-by: Theodore Ts'o --- lib/blkid/cache.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'lib') diff --git a/lib/blkid/cache.c b/lib/blkid/cache.c index 1508d0f8..efd4656e 100644 --- a/lib/blkid/cache.c +++ b/lib/blkid/cache.c @@ -154,13 +154,13 @@ void blkid_put_cache(blkid_cache cache) void blkid_gc_cache(blkid_cache cache) { - struct list_head *p; + struct list_head *p, *pnext; struct stat st; if (!cache) return; - list_for_each(p, &cache->bic_devs) { + list_for_each_safe(p, pnext, &cache->bic_devs) { blkid_dev dev = list_entry(p, struct blkid_struct_dev, bid_devs); if (!p) break; -- cgit v1.2.3