fetch: close downloaded file. unlink on failure
parent
ebe43a5e01
commit
33da51c596
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue