diff options
author | Natanael Copa <ncopa@alpinelinux.org> | 2009-04-15 09:58:47 +0000 |
---|---|---|
committer | Natanael Copa <ncopa@alpinelinux.org> | 2009-04-15 10:00:14 +0000 |
commit | 33da51c596237e8e813d6c18e064939e4ebef445 (patch) | |
tree | ce445b5539cddbe99c70365a7edb9269797f4c8b | |
parent | ebe43a5e01c7a581e12db6494419098d1556f5be (diff) | |
download | apk-tools-33da51c596237e8e813d6c18e064939e4ebef445.tar.gz apk-tools-33da51c596237e8e813d6c18e064939e4ebef445.tar.bz2 apk-tools-33da51c596237e8e813d6c18e064939e4ebef445.tar.xz apk-tools-33da51c596237e8e813d6c18e064939e4ebef445.zip |
fetch: close downloaded file. unlink on failure
-rw-r--r-- | src/fetch.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/fetch.c b/src/fetch.c index 40b8a24..9e0d930 100644 --- a/src/fetch.c +++ b/src/fetch.c @@ -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; } |