fetch: fix fd leak

we should always close the in-stream, not only on failure.
cute-signatures
Natanael Copa 2009-05-26 14:12:02 +00:00
parent fed1474d5a
commit c8c9851369
1 changed files with 1 additions and 1 deletions

View File

@ -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;