Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorDan McGee <dan@archlinux.org>2011-10-25 10:40:26 -0500
committerDan McGee <dan@archlinux.org>2011-10-25 10:40:26 -0500
commita708e7d28e890c3e230a215629b7f5c58c57f58d (patch)
treeb5efd2a09bdca63a8581d52df55bf93332db47b9 /lib
parent90ddcbe71d483884b7627237121b1dee05b07dd0 (diff)
parent2da59e1aa91fa4160ec1c8ec84d94d8141b2a832 (diff)
Merge branch 'maint'
Diffstat (limited to 'lib')
-rw-r--r--lib/libalpm/dload.c14
-rw-r--r--lib/libalpm/sync.c8
2 files changed, 17 insertions, 5 deletions
diff --git a/lib/libalpm/dload.c b/lib/libalpm/dload.c
index cd2857c3..9d919b0a 100644
--- a/lib/libalpm/dload.c
+++ b/lib/libalpm/dload.c
@@ -392,8 +392,15 @@ static int curl_download_internal(struct dload_payload *payload,
case CURLE_OK:
/* get http/ftp response code */
curl_easy_getinfo(curl, CURLINFO_RESPONSE_CODE, &respcode);
+ _alpm_log(handle, ALPM_LOG_DEBUG, "response code: %ld\n", respcode);
if(respcode >= 400) {
payload->unlink_on_fail = 1;
+ /* non-translated message is same as libcurl */
+ snprintf(error_buffer, sizeof(error_buffer),
+ "The requested URL returned error: %ld", respcode);
+ _alpm_log(handle, ALPM_LOG_ERROR,
+ _("failed retrieving file '%s' from %s : %s\n"),
+ payload->remote_name, hostname, error_buffer);
goto cleanup;
}
break;
@@ -402,15 +409,16 @@ static int curl_download_internal(struct dload_payload *payload,
if(dload_interrupted == ABORT_OVER_MAXFILESIZE) {
payload->curlerr = CURLE_FILESIZE_EXCEEDED;
handle->pm_errno = ALPM_ERR_LIBCURL;
- /* the hardcoded 'size exceeded' message is same as libcurl's normal */
+ /* use the 'size exceeded' message from libcurl */
_alpm_log(handle, ALPM_LOG_ERROR,
_("failed retrieving file '%s' from %s : %s\n"),
- payload->remote_name, hostname, "Maximum file size exceeded");
+ payload->remote_name, hostname,
+ curl_easy_strerror(CURLE_FILESIZE_EXCEEDED));
}
goto cleanup;
default:
/* delete zero length downloads */
- if(stat(payload->tempfile_name, &st) == 0 && st.st_size == 0) {
+ if(fstat(fileno(localf), &st) == 0 && st.st_size == 0) {
payload->unlink_on_fail = 1;
}
if(!payload->errors_ok) {
diff --git a/lib/libalpm/sync.c b/lib/libalpm/sync.c
index 78f7da9a..52049a8c 100644
--- a/lib/libalpm/sync.c
+++ b/lib/libalpm/sync.c
@@ -288,6 +288,7 @@ static int compute_download_size(alpm_pkg_t *newpkg)
char *fpath, *fnamepart = NULL;
off_t size = 0;
alpm_handle_t *handle = newpkg->handle;
+ int ret = 0;
if(newpkg->origin != PKG_FROM_SYNCDB) {
newpkg->infolevel |= INFRQ_DSIZE;
@@ -316,6 +317,9 @@ static int compute_download_size(alpm_pkg_t *newpkg)
size = newpkg->size - st.st_size;
size = size < 0 ? 0 : size;
}
+
+ /* tell the caller that we have a partial */
+ ret = 1;
} else if(handle->usedelta) {
off_t dltsize;
@@ -345,7 +349,7 @@ finish:
FREE(fpath);
FREE(fnamepart);
- return 0;
+ return ret;
}
int _alpm_sync_prepare(alpm_handle_t *handle, alpm_list_t **data)
@@ -606,7 +610,7 @@ int _alpm_sync_prepare(alpm_handle_t *handle, alpm_list_t **data)
for(i = trans->add; i; i = i->next) {
/* update download size field */
alpm_pkg_t *spkg = i->data;
- if(compute_download_size(spkg) != 0) {
+ if(compute_download_size(spkg) < 0) {
ret = -1;
goto cleanup;
}