From 9c7ebe68724791f06cdde2febdf91f0472f18407 Mon Sep 17 00:00:00 2001 From: Dan McGee Date: Sun, 6 Apr 2008 20:28:43 -0500 Subject: Remove a bit more download.h pollution Kill it where it isn't absolutely necessary. Signed-off-by: Dan McGee --- lib/libalpm/db.c | 10 +++------- lib/libalpm/dload.c | 2 ++ 2 files changed, 5 insertions(+), 7 deletions(-) (limited to 'lib') diff --git a/lib/libalpm/db.c b/lib/libalpm/db.c index 9bdbc7a2..e8ae11a3 100644 --- a/lib/libalpm/db.c +++ b/lib/libalpm/db.c @@ -33,7 +33,6 @@ #include #include #include -#include /* downloadLastErrString among others. kill this */ /* libalpm */ #include "db.h" @@ -254,12 +253,9 @@ int SYMEXPORT alpm_db_update(int force, pmdb_t *db) pm_errno = 0; return(1); } else if(ret == -1) { - /* we use downloadLastErrString and downloadLastErrCode here, - * error returns from libdownload */ - /* TODO we may not have used libdownload, this should change */ - _alpm_log(PM_LOG_DEBUG, "failed to sync db: %s [%d]\n", - downloadLastErrString, downloadLastErrCode); - RET_ERR(PM_ERR_DB_SYNC, -1); + /* pm_errno was set by the download code */ + _alpm_log(PM_LOG_DEBUG, "failed to sync db: %s\n", alpm_strerrorlast()); + return(-1); } else { /* form the path to the db location */ snprintf(path, PATH_MAX, "%s%s" DBEXT, dbpath, db->treename); diff --git a/lib/libalpm/dload.c b/lib/libalpm/dload.c index 1b7b013f..ceaf2743 100644 --- a/lib/libalpm/dload.c +++ b/lib/libalpm/dload.c @@ -136,6 +136,7 @@ static int download_internal(const char *url, const char *localpath, if(strcmp(SCHEME_FILE, fileurl->scheme) != 0) { host = fileurl->host; } + pm_errno = PM_ERR_LIBDOWNLOAD; _alpm_log(PM_LOG_ERROR, _("failed retrieving file '%s' from %s : %s\n"), filename, host, downloadLastErrString); ret = -1; @@ -183,6 +184,7 @@ static int download_internal(const char *url, const char *localpath, char buffer[PM_DLBUF_LEN]; while((nread = fread(buffer, 1, PM_DLBUF_LEN, dlf)) > 0) { if(ferror(dlf)) { + pm_errno = PM_ERR_LIBDOWNLOAD; _alpm_log(PM_LOG_ERROR, _("error downloading '%s': %s\n"), filename, downloadLastErrString); ret = -1; -- cgit v1.2.3-70-g09d2