Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/lib/libalpm/dload.c
diff options
context:
space:
mode:
authorDan McGee <dan@archlinux.org>2011-06-07 16:13:58 -0500
committerDan McGee <dan@archlinux.org>2011-06-13 19:41:16 -0500
commit52bffd2457b7ba3b6fb08d3aa959ea0b53a45dc8 (patch)
treef426280f674b10c2175bd99feba8ec0e42d7b0de /lib/libalpm/dload.c
parente2aa952689da8763d534d1c19310eb97009f4f76 (diff)
Switch all logging to use handle directly
This is the last user of our global handle object. Once again the diff is large but the functional changes are not. Signed-off-by: Dan McGee <dan@archlinux.org>
Diffstat (limited to 'lib/libalpm/dload.c')
-rw-r--r--lib/libalpm/dload.c19
1 files changed, 9 insertions, 10 deletions
diff --git a/lib/libalpm/dload.c b/lib/libalpm/dload.c
index fee5a988..46925a99 100644
--- a/lib/libalpm/dload.c
+++ b/lib/libalpm/dload.c
@@ -129,7 +129,6 @@ static int curl_gethost(const char *url, char *buffer)
hostlen = strcspn(p, "/");
if(hostlen > 255) {
/* buffer overflow imminent */
- _alpm_log(PM_LOG_ERROR, _("buffer overflow detected"));
return 1;
}
snprintf(buffer, hostlen + 1, "%s", p);
@@ -172,7 +171,7 @@ static int curl_download_internal(pmhandle_t *handle,
dlfile.initial_size = 0.0;
dlfile.filename = get_filename(url);
if(!dlfile.filename || curl_gethost(url, hostname) != 0) {
- _alpm_log(PM_LOG_ERROR, _("url '%s' is invalid\n"), url);
+ _alpm_log(handle, PM_LOG_ERROR, _("url '%s' is invalid\n"), url);
RET_ERR(handle, PM_ERR_SERVER_BAD_URL, -1);
}
@@ -212,7 +211,7 @@ static int curl_download_internal(pmhandle_t *handle,
/* a previous partial download exists, resume from end of file. */
open_mode = "ab";
curl_easy_setopt(handle->curl, CURLOPT_RESUME_FROM, (long)st.st_size);
- _alpm_log(PM_LOG_DEBUG, "tempfile found, attempting continuation");
+ _alpm_log(handle, PM_LOG_DEBUG, "tempfile found, attempting continuation");
dlfile.initial_size = (double)st.st_size;
}
@@ -250,10 +249,10 @@ static int curl_download_internal(pmhandle_t *handle,
} else if(handle->curlerr != CURLE_OK) {
if(!errors_ok) {
handle->pm_errno = PM_ERR_LIBCURL;
- _alpm_log(PM_LOG_ERROR, _("failed retrieving file '%s' from %s : %s\n"),
+ _alpm_log(handle, PM_LOG_ERROR, _("failed retrieving file '%s' from %s : %s\n"),
dlfile.filename, hostname, error_buffer);
} else {
- _alpm_log(PM_LOG_DEBUG, "failed retrieving file '%s' from %s : %s\n",
+ _alpm_log(handle, PM_LOG_DEBUG, "failed retrieving file '%s' from %s : %s\n",
dlfile.filename, hostname, error_buffer);
}
unlink(tempfile);
@@ -280,7 +279,7 @@ static int curl_download_internal(pmhandle_t *handle,
if(!DOUBLE_EQ(remote_size, -1) && !DOUBLE_EQ(bytes_dl, -1) &&
!DOUBLE_EQ(bytes_dl, remote_size)) {
handle->pm_errno = PM_ERR_RETRIEVE;
- _alpm_log(PM_LOG_ERROR, _("%s appears to be truncated: %jd/%jd bytes\n"),
+ _alpm_log(handle, PM_LOG_ERROR, _("%s appears to be truncated: %jd/%jd bytes\n"),
dlfile.filename, (intmax_t)bytes_dl, (intmax_t)remote_size);
goto cleanup;
}
@@ -346,10 +345,10 @@ char SYMEXPORT *alpm_fetch_pkgurl(pmhandle_t *handle, const char *url)
/* download the file */
ret = _alpm_download(handle, url, cachedir, 0, 1, 0);
if(ret == -1) {
- _alpm_log(PM_LOG_WARNING, _("failed to download %s\n"), url);
+ _alpm_log(handle, PM_LOG_WARNING, _("failed to download %s\n"), url);
return NULL;
}
- _alpm_log(PM_LOG_DEBUG, "successfully downloaded %s\n", url);
+ _alpm_log(handle, PM_LOG_DEBUG, "successfully downloaded %s\n", url);
/* attempt to download the signature */
if(ret == 0 && (handle->sigverify == PM_PGP_VERIFY_ALWAYS ||
@@ -364,11 +363,11 @@ char SYMEXPORT *alpm_fetch_pkgurl(pmhandle_t *handle, const char *url)
ret = _alpm_download(handle, sig_url, cachedir, 1, 0, errors_ok);
if(ret == -1 && !errors_ok) {
- _alpm_log(PM_LOG_WARNING, _("failed to download %s\n"), sig_url);
+ _alpm_log(handle, PM_LOG_WARNING, _("failed to download %s\n"), sig_url);
/* Warn now, but don't return NULL. We will fail later during package
* load time. */
} else if(ret == 0) {
- _alpm_log(PM_LOG_DEBUG, "successfully downloaded %s\n", sig_url);
+ _alpm_log(handle, PM_LOG_DEBUG, "successfully downloaded %s\n", sig_url);
}
FREE(sig_url);
}