bin/xbps-rindex/remove-obsoletes.c: also remove pkg signature files.

This commit is contained in:
Juan RP 2013-12-24 12:02:33 +01:00
parent 0a5fa442f2
commit 98748bdcd1

View File

@ -39,23 +39,29 @@
static int static int
remove_pkg(const char *repodir, const char *file) remove_pkg(const char *repodir, const char *file)
{ {
char *filepath; char *filepath, *sigpath;
int rv; int rv = 0;
filepath = xbps_xasprintf("%s/%s", repodir, file); filepath = xbps_xasprintf("%s/%s", repodir, file);
sigpath = xbps_xasprintf("%s.sig", filepath);
if (remove(filepath) == -1) { if (remove(filepath) == -1) {
if (errno != ENOENT) { if (errno != ENOENT) {
rv = errno; rv = errno;
fprintf(stderr, "xbps-rindex: failed to remove " fprintf(stderr, "xbps-rindex: failed to remove "
"package `%s': %s\n", file, "package `%s': %s\n", file, strerror(rv));
strerror(rv));
free(filepath);
return rv;
} }
} }
if (remove(sigpath) == -1) {
if (errno != ENOENT) {
rv = errno;
fprintf(stderr, "xbps-rindex: failed to remove "
"package signature `%s': %s\n", sigpath, strerror(rv));
}
}
free(sigpath);
free(filepath); free(filepath);
return 0; return rv;
} }
static int static int