[pacman-dev] [PATCH] Correctly report a download failiure for 404s

Allan McRae allan at archlinux.org
Fri Jun 28 03:40:11 UTC 2019


On 12/6/19 2:43 am, morganamilo wrote:
> Currently when caling alpm_trans_commit, if fetching a package restults
> in a 404 (or other non 400 response code), the function returns -1 but
> errno is never set.
> 
> Thish patch sets errno to ALPM_ERR_RETRIEVE.
> 

OK.  Fixed typo in commit message.

> diff --git a/lib/libalpm/dload.c b/lib/libalpm/dload.c
> index 05813c40..e5696bb0 100644
> --- a/lib/libalpm/dload.c
> +++ b/lib/libalpm/dload.c
> @@ -454,6 +454,7 @@ static int curl_download_internal(struct dload_payload *payload,
>  			if(payload->respcode >= 400) {
>  				payload->unlink_on_fail = 1;
>  				if(!payload->errors_ok) {
> +					handle->pm_errno = ALPM_ERR_RETRIEVE;
>  					/* non-translated message is same as libcurl */
>  					snprintf(error_buffer, sizeof(error_buffer),
>  							"The requested URL returned error: %ld", payload->respcode);
> 


More information about the pacman-dev mailing list