[pacman-dev] [PATCH 2/2] ensure package download sizes are invalidated when an error occurs

Jonathan Conder j at skurvy.no-ip.org
Sun May 16 01:34:42 EDT 2010


Signed-off-by: Jonathan Conder <j at skurvy.no-ip.org>
---
 lib/libalpm/sync.c |   16 +++++++---------
 1 files changed, 7 insertions(+), 9 deletions(-)

diff --git a/lib/libalpm/sync.c b/lib/libalpm/sync.c
index d9f4c28..9e140dc 100644
--- a/lib/libalpm/sync.c
+++ b/lib/libalpm/sync.c
@@ -855,9 +855,7 @@ int _alpm_sync_commit(pmtrans_t *trans, pmdb_t *db_local, alpm_list_t **data)
 
 		if(files) {
 			EVENT(trans, PM_TRANS_EVT_RETRIEVE_START, current->treename, NULL);
-			errors = _alpm_download_files(files, current->servers, cachedir);
-
-			if (errors) {
+			if(_alpm_download_files(files, current->servers, cachedir)) {
 				_alpm_log(PM_LOG_WARNING, _("failed to retrieve some files from %s\n"),
 						current->treename);
 				if(pm_errno == 0) {
@@ -869,12 +867,6 @@ int _alpm_sync_commit(pmtrans_t *trans, pmdb_t *db_local, alpm_list_t **data)
 		}
 	}
 
-	for(j = trans->add; j; j = j->next) {
-		pmpkg_t *pkg = j->data;
-		pkg->infolevel &= ~INFRQ_DSIZE;
-		pkg->download_size = 0;
-	}
-
 	/* clear out value to let callback know we are done */
 	if(handle->totaldlcb) {
 		handle->totaldlcb(0);
@@ -1003,6 +995,12 @@ int _alpm_sync_commit(pmtrans_t *trans, pmdb_t *db_local, alpm_list_t **data)
 	ret = 0;
 
 error:
+	for(j = trans->add; j; j = j->next) {
+		pmpkg_t *pkg = j->data;
+		pkg->infolevel &= ~INFRQ_DSIZE;
+		pkg->download_size = 0;
+	}
+
 	FREELIST(files);
 	alpm_list_free(deltas);
 	return(ret);
-- 
1.7.1




More information about the pacman-dev mailing list