Commit c8c98513 authored by Natanael Copa's avatar Natanael Copa
Browse files

fetch: fix fd leak

we should always close the in-stream, not only on failure.
parent fed1474d
......@@ -95,10 +95,10 @@ static int fetch_package(struct fetch_ctx *fctx,
}
r = apk_istream_splice(is, fd, pkg->size, NULL, NULL);
is->close(is);
if (fd != STDOUT_FILENO)
close(fd);
if (r != pkg->size) {
is->close(is);
apk_error("Unable to download '%s'", file);
unlink(file);
return -1;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment