From 017a100c7a7d0a634b9481ca8ccb12cf839dd1a1 Mon Sep 17 00:00:00 2001 From: Nikias Bassen Date: Thu, 9 Feb 2012 17:33:44 +0100 Subject: download: call fclose before removing the file --- src/download.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/download.c') diff --git a/src/download.c b/src/download.c index bd794b1..8fb482a 100644 --- a/src/download.c +++ b/src/download.c @@ -103,13 +103,13 @@ int download_to_file(const char* url, const char* filename) curl_easy_cleanup(handle); off_t sz = ftello(f); + fclose(f); + if ((sz == 0) || (sz == (off_t)-1)) { res = -1; remove(filename); } - fclose(f); - curl_global_cleanup(); return res; -- cgit v1.1-32-gdbae