[pacman-dev] [PATCH 1/2] dload: reset payload filename members	before download
    Dave Reisner 
    d at falconindy.com
       
    Wed Mar 14 23:13:01 EDT 2012
    
    
  
To avoid conflicts on reusing a payload after a failed download, ensure
that we reset the filename hints in the payload struct prior to the
download operation.
Signed-off-by: Dave Reisner <dreisner at archlinux.org>
---
 lib/libalpm/dload.c |    5 +++++
 1 file changed, 5 insertions(+)
diff --git a/lib/libalpm/dload.c b/lib/libalpm/dload.c
index 0598806..b3ac024 100644
--- a/lib/libalpm/dload.c
+++ b/lib/libalpm/dload.c
@@ -390,6 +390,11 @@ static int curl_download_internal(struct dload_payload *payload,
 	CURL *curl = get_libcurl_handle(handle);
 	handle->pm_errno = 0;
 
+	/* make sure these are NULL */
+	FREE(payload->tempfile_name);
+	FREE(payload->destfile_name);
+	FREE(payload->content_disp_name);
+
 	payload->tempfile_openmode = "wb";
 	if(!payload->remote_name) {
 		STRDUP(payload->remote_name, get_filename(payload->fileurl),
-- 
1.7.9.4
    
    
More information about the pacman-dev
mailing list