[pacman-dev] [PATCH 2/2] lib/dload.c: remove assumption in continuation logic

Dave Reisner d at falconindy.com
Wed Jun 1 15:24:07 EDT 2011


Callers to curl_download_internal now tell us if its okay to continue a
transfer, so obey this instead of using a heuristic.

Signed-off-by: Dave Reisner <d at falconindy.com>
---
 lib/libalpm/dload.c |    6 ++----
 1 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/lib/libalpm/dload.c b/lib/libalpm/dload.c
index 3d90130..c79e5d2 100644
--- a/lib/libalpm/dload.c
+++ b/lib/libalpm/dload.c
@@ -202,10 +202,8 @@ static int curl_download_internal(const char *url, const char *localpath,
 		curl_easy_setopt(handle->curl, CURLOPT_USERAGENT, useragent);
 	}
 
-	/* TODO: no assuming here. the calling function should tell us what's kosher */
-	if(!force && stat(destfile, &st) == 0) {
-		/* assume its a sync, so we're starting from scratch. but, only download
-		 * our local is out of date. */
+	if(!force && stat(destfile, &st) == 0 && !allow_resume) {
+		/* start from scratch, but only download our local is out of date. */
 		curl_easy_setopt(handle->curl, CURLOPT_TIMECONDITION, CURL_TIMECOND_IFMODSINCE);
 		curl_easy_setopt(handle->curl, CURLOPT_TIMEVALUE, (long)st.st_mtime);
 	} else if(stat(tempfile, &st) == 0 && allow_resume) {
-- 
1.7.5.2



More information about the pacman-dev mailing list