diff mbox

[pacman-dev] libalpm/dload.c: add case for CURLE_COULDNT_RESOLVE_HOST

Message ID 20180610165834.7611-1-straubem@gmx.de
State Accepted, archived
Headers show

Commit Message

Michael Straube June 10, 2018, 4:58 p.m. UTC
Add a case for curl error 'Could not resolve host'.
An attempt to fix FS#48285.

Signed-off-by: Michael Straube <straubem@gmx.de>
---
 lib/libalpm/dload.c | 7 +++++++
 1 file changed, 7 insertions(+)

Comments

Allan McRae June 19, 2018, 2:28 p.m. UTC | #1
On 11/06/18 02:58, Michael Straube wrote:
> Add a case for curl error 'Could not resolve host'.
> An attempt to fix FS#48285.
> 
> Signed-off-by: Michael Straube <straubem@gmx.de>
> ---

Certainly an improvement to the reported error.  We still need to look
at abandoning a mirror if it is bad rather than print the same error for
every database...

Pulled to my queue.

A

>  lib/libalpm/dload.c | 7 +++++++
>  1 file changed, 7 insertions(+)
> 
> diff --git a/lib/libalpm/dload.c b/lib/libalpm/dload.c
> index eeef32f5..7f34c89e 100644
> --- a/lib/libalpm/dload.c
> +++ b/lib/libalpm/dload.c
> @@ -473,6 +473,13 @@ static int curl_download_internal(struct dload_payload *payload,
>  						payload->remote_name, hostname);
>  			}
>  			goto cleanup;
> +		case CURLE_COULDNT_RESOLVE_HOST:
> +			payload->unlink_on_fail = 1;
> +			handle->pm_errno = ALPM_ERR_SERVER_BAD_URL;
> +			_alpm_log(handle, ALPM_LOG_ERROR,
> +					_("failed retrieving file '%s' from %s : %s\n"),
> +					payload->remote_name, hostname, error_buffer);
> +			goto cleanup;
>  		default:
>  			/* delete zero length downloads */
>  			if(fstat(fileno(localf), &st) == 0 && st.st_size == 0) {
>
diff mbox

Patch

diff --git a/lib/libalpm/dload.c b/lib/libalpm/dload.c
index eeef32f5..7f34c89e 100644
--- a/lib/libalpm/dload.c
+++ b/lib/libalpm/dload.c
@@ -473,6 +473,13 @@  static int curl_download_internal(struct dload_payload *payload,
 						payload->remote_name, hostname);
 			}
 			goto cleanup;
+		case CURLE_COULDNT_RESOLVE_HOST:
+			payload->unlink_on_fail = 1;
+			handle->pm_errno = ALPM_ERR_SERVER_BAD_URL;
+			_alpm_log(handle, ALPM_LOG_ERROR,
+					_("failed retrieving file '%s' from %s : %s\n"),
+					payload->remote_name, hostname, error_buffer);
+			goto cleanup;
 		default:
 			/* delete zero length downloads */
 			if(fstat(fileno(localf), &st) == 0 && st.st_size == 0) {