summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/fetch.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/fetch.c b/src/fetch.c
index 40b8a24..9e0d930 100644
--- a/src/fetch.c
+++ b/src/fetch.c
@@ -95,9 +95,12 @@ static int fetch_package(struct fetch_ctx *fctx,
}
r = apk_istream_splice(is, fd, pkg->size, NULL, NULL);
+ if (fd != STDOUT_FILENO)
+ close(fd);
if (r != pkg->size) {
is->close(is);
apk_error("Unable to download '%s'", file);
+ unlink(file);
return -1;
}