Skip to content
Snippets Groups Projects
Commit 33da51c5 authored by Natanael Copa's avatar Natanael Copa
Browse files

fetch: close downloaded file. unlink on failure

parent ebe43a5e
No related branches found
No related tags found
No related merge requests found
......@@ -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;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment