From 766cbcf68333d2632dadbaf3e7d41fc9acfeab07 Mon Sep 17 00:00:00 2001 From: Juan RP Date: Sat, 2 Aug 2014 10:00:54 +0200 Subject: [PATCH] xbps-remove(8): fix assertion when the cachedir is empty. --- NEWS | 3 +++ bin/xbps-remove/clean-cache.c | 6 ++++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/NEWS b/NEWS index 36a7fcab..a8e91481 100644 --- a/NEWS +++ b/NEWS @@ -1,5 +1,8 @@ xbps-0.38 (???): + * xbps-remove(8): -O/--clean-cache no longer triggers an assertion when the + cache directory is empty. + * Implemented support to preserve existent on-disk files, by always ignoring the pkg content if the file has been matched. Details here: https://github.com/voidlinux/xbps/issues/51 diff --git a/bin/xbps-remove/clean-cache.c b/bin/xbps-remove/clean-cache.c index 650b5319..cacc6aa8 100644 --- a/bin/xbps-remove/clean-cache.c +++ b/bin/xbps-remove/clean-cache.c @@ -136,7 +136,9 @@ clean_cachedir(struct xbps_handle *xhp) } (void)closedir(dirp); - rv = xbps_array_foreach_cb_multi(xhp, array, NULL, cleaner_cb, NULL); - xbps_object_release(array); + if (xbps_array_count(array)) { + rv = xbps_array_foreach_cb_multi(xhp, array, NULL, cleaner_cb, NULL); + xbps_object_release(array); + } return rv; }