xbps-repo: [clean] print err msg when unlink(2) fails.

This commit is contained in:
Juan RP 2012-06-19 10:55:42 +02:00
parent f4e97228c8
commit 5cb0d17f8e

View File

@ -80,13 +80,18 @@ cachedir_clean(struct xbps_handle *xhp)
if (xbps_file_hash_check(binpkg, rsha256) == ERANGE) {
printf("Removed %s from cachedir (sha256 mismatch)\n",
dp->d_name);
unlink(binpkg);
if (unlink(binpkg) == -1)
fprintf(stderr, "Failed to remove "
"`%s': %s\n", binpkg,
strerror(errno));
}
free(binpkg);
continue;
}
printf("Removed %s from cachedir (obsolete)\n", dp->d_name);
unlink(binpkg);
if (unlink(binpkg) == -1)
fprintf(stderr, "Failed to remove `%s': %s\n",
binpkg, strerror(errno));
free(binpkg);
}
closedir(dirp);