From 9759a62e3f39a9e252cd0bb13d714230fcf3baf7 Mon Sep 17 00:00:00 2001 From: Juan RP Date: Fri, 25 Feb 2011 10:51:43 +0100 Subject: [PATCH] Do not printf a warning if remove(3) returns EEXIST/ENOTEMPTY/EBUSY. --- lib/package_remove.c | 5 +++-- lib/package_remove_obsoletes.c | 18 ++++++++++-------- 2 files changed, 13 insertions(+), 10 deletions(-) diff --git a/lib/package_remove.c b/lib/package_remove.c index b1a20b4d..c29ee2f8 100644 --- a/lib/package_remove.c +++ b/lib/package_remove.c @@ -153,10 +153,11 @@ xbps_remove_pkg_files(prop_dictionary_t dict, const char *key) * Remove the object if possible. */ if (remove(path) == -1) { - if (xhp->flags & XBPS_FLAG_VERBOSE) + if (errno != EEXIST && + errno != ENOTEMPTY && + errno != EBUSY) xbps_warn_printf("can't remove %s `%s': %s\n", curobj, file, strerror(errno)); - } else { /* Success */ if (xhp->flags & XBPS_FLAG_VERBOSE) diff --git a/lib/package_remove_obsoletes.c b/lib/package_remove_obsoletes.c index 99bce980..119bbf76 100644 --- a/lib/package_remove_obsoletes.c +++ b/lib/package_remove_obsoletes.c @@ -126,21 +126,23 @@ again: free(file); continue; } - /* * Obsolete obj found, remove it. */ if (remove(file) == -1) { - xbps_warn_printf("couldn't remove obsole entry " - "`%s': %s\n", prop_string_cstring_nocopy(oldstr), - strerror(errno)); + if (errno != EEXIST && + errno != ENOTEMPTY && + errno != EBUSY) { + xbps_warn_printf("couldn't remove obsole entry " + "`%s': %s\n", + prop_string_cstring_nocopy(oldstr), + strerror(errno)); + } free(file); continue; } - if (xhp->flags & XBPS_FLAG_VERBOSE) - xbps_printf("Removed obsolete entry: %s\n", - prop_string_cstring_nocopy(oldstr)); - + xbps_printf("Removed obsolete entry: %s\n", + prop_string_cstring_nocopy(oldstr)); free(file); } if (!dolinks) {