[pacman-dev,v2] libalpm: fix error when downloading up to date files

Message ID 20210501202535.3638221-1-morganamilo@archlinux.org
State New
Headers show
Series [pacman-dev,v2] libalpm: fix error when downloading up to date files | expand

Commit Message

morganamilo May 1, 2021, 8:25 p.m. UTC
---
 lib/libalpm/sync.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Allan McRae May 3, 2021, 2:59 a.m. UTC | #1
On 2/5/21 6:25 am, morganamilo wrote:
> ---
>  lib/libalpm/sync.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/lib/libalpm/sync.c b/lib/libalpm/sync.c
> index 2419cc69..bdfab635 100644
> --- a/lib/libalpm/sync.c
> +++ b/lib/libalpm/sync.c
> @@ -1128,7 +1128,7 @@ int _alpm_sync_load(alpm_handle_t *handle, alpm_list_t **data)
>  	uint64_t total_bytes = 0;
>  	alpm_trans_t *trans = handle->trans;
>  
> -	if(download_files(handle)) {
> +	if(download_files(handle) == -1) {
>  		return -1;
>  	}
>  


Updated commit message:

libalpm: fix error when installing cached packages without signatures

With a repo using "SigLevel = Optional" and a package already downloaded
into the cache, download_files() returns 1 (via _alpm_download) to
indicate no files were downloaded.  This causes installation of the
package to fail.

Explicitly check that download_files() returns -1 (error) rather than
non-zero.

Patch

diff --git a/lib/libalpm/sync.c b/lib/libalpm/sync.c
index 2419cc69..bdfab635 100644
--- a/lib/libalpm/sync.c
+++ b/lib/libalpm/sync.c
@@ -1128,7 +1128,7 @@  int _alpm_sync_load(alpm_handle_t *handle, alpm_list_t **data)
 	uint64_t total_bytes = 0;
 	alpm_trans_t *trans = handle->trans;
 
-	if(download_files(handle)) {
+	if(download_files(handle) == -1) {
 		return -1;
 	}