From 59bb21fce369e6453e00791cbb788e502e4039e9 Mon Sep 17 00:00:00 2001 From: Andrew Gregory Date: Sat, 16 Dec 2017 12:41:11 -0500 Subject: dload: ensure callback is always initialized once Frontends rely on an initialization call for setup between downloads. Checking for intialization after checking for a completed download can skip initialization in cases where files are small enough to be downloaded all at once (FS#56408). Relying on previous download size can result in multiple initializations if there are multiple non-transfer events prior to the download starting (fS#56468). Introduce a new cb_initialized variable to the payload struct and use it to ensure that the callback is initialized exactly once prior to any actual events. Fixes FS#56408, FS#56468 Signed-off-by: Andrew Gregory Signed-off-by: Allan McRae --- lib/libalpm/dload.h | 1 + 1 file changed, 1 insertion(+) (limited to 'lib/libalpm/dload.h') diff --git a/lib/libalpm/dload.h b/lib/libalpm/dload.h index 6ca775a7..ac948528 100644 --- a/lib/libalpm/dload.h +++ b/lib/libalpm/dload.h @@ -41,6 +41,7 @@ struct dload_payload { int errors_ok; int unlink_on_fail; int trust_remote_name; + int cb_initialized; #ifdef HAVE_LIBCURL CURLcode curlerr; /* last error produced by curl */ #endif -- cgit v1.2.3-54-g00ecf