fetch: fix fd leak
we should always close the in-stream, not only on failure.cute-signatures
parent
fed1474d5a
commit
c8c9851369
|
@ -95,10 +95,10 @@ static int fetch_package(struct fetch_ctx *fctx,
|
||||||
}
|
}
|
||||||
|
|
||||||
r = apk_istream_splice(is, fd, pkg->size, NULL, NULL);
|
r = apk_istream_splice(is, fd, pkg->size, NULL, NULL);
|
||||||
|
is->close(is);
|
||||||
if (fd != STDOUT_FILENO)
|
if (fd != STDOUT_FILENO)
|
||||||
close(fd);
|
close(fd);
|
||||||
if (r != pkg->size) {
|
if (r != pkg->size) {
|
||||||
is->close(is);
|
|
||||||
apk_error("Unable to download '%s'", file);
|
apk_error("Unable to download '%s'", file);
|
||||||
unlink(file);
|
unlink(file);
|
||||||
return -1;
|
return -1;
|
||||||
|
|
Loading…
Reference in New Issue