Do not printf a warning if remove(3) returns EEXIST/ENOTEMPTY/EBUSY.

This commit is contained in:
Juan RP 2011-02-25 10:51:43 +01:00
parent 777a91f62a
commit 9759a62e3f
2 changed files with 13 additions and 10 deletions

View File

@ -153,10 +153,11 @@ xbps_remove_pkg_files(prop_dictionary_t dict, const char *key)
* Remove the object if possible. * Remove the object if possible.
*/ */
if (remove(path) == -1) { 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", xbps_warn_printf("can't remove %s `%s': %s\n",
curobj, file, strerror(errno)); curobj, file, strerror(errno));
} else { } else {
/* Success */ /* Success */
if (xhp->flags & XBPS_FLAG_VERBOSE) if (xhp->flags & XBPS_FLAG_VERBOSE)

View File

@ -126,21 +126,23 @@ again:
free(file); free(file);
continue; continue;
} }
/* /*
* Obsolete obj found, remove it. * Obsolete obj found, remove it.
*/ */
if (remove(file) == -1) { if (remove(file) == -1) {
if (errno != EEXIST &&
errno != ENOTEMPTY &&
errno != EBUSY) {
xbps_warn_printf("couldn't remove obsole entry " xbps_warn_printf("couldn't remove obsole entry "
"`%s': %s\n", prop_string_cstring_nocopy(oldstr), "`%s': %s\n",
prop_string_cstring_nocopy(oldstr),
strerror(errno)); strerror(errno));
}
free(file); free(file);
continue; continue;
} }
if (xhp->flags & XBPS_FLAG_VERBOSE)
xbps_printf("Removed obsolete entry: %s\n", xbps_printf("Removed obsolete entry: %s\n",
prop_string_cstring_nocopy(oldstr)); prop_string_cstring_nocopy(oldstr));
free(file); free(file);
} }
if (!dolinks) { if (!dolinks) {