From c12ccbfb2c7aa907ba01339a1a29089c65ea9911 Mon Sep 17 00:00:00 2001 From: Dan McGee Date: Fri, 4 Feb 2011 09:00:47 -0600 Subject: Add more error checking and logging Signed-off-by: Dan McGee --- lib/libalpm/dload.c | 6 +++++- lib/libalpm/util.c | 2 +- src/pacman/upgrade.c | 2 ++ 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/lib/libalpm/dload.c b/lib/libalpm/dload.c index c856e96c..15d75556 100644 --- a/lib/libalpm/dload.c +++ b/lib/libalpm/dload.c @@ -296,7 +296,11 @@ static int download_internal(const char *url, const char *localpath, tv[1].tv_sec = ust.mtime; utimes(tempfile, tv); } - rename(tempfile, destfile); + if(rename(tempfile, destfile)) { + _alpm_log(PM_LOG_ERROR, _("could not rename %s to %s (%s)\n"), + tempfile, destfile, strerror(errno)); + ret = -1; + } ret = 0; cleanup: diff --git a/lib/libalpm/util.c b/lib/libalpm/util.c index a80a7327..458f750a 100644 --- a/lib/libalpm/util.c +++ b/lib/libalpm/util.c @@ -621,7 +621,7 @@ char *_alpm_filecache_find(const char* filename) } } /* package wasn't found in any cachedir */ - return(NULL); + RET_ERR(PM_ERR_PKG_NOT_FOUND, NULL); } /** Check the alpm cachedirs for existance and find a writable one. diff --git a/src/pacman/upgrade.c b/src/pacman/upgrade.c index 595e4aab..8cd29da0 100644 --- a/src/pacman/upgrade.c +++ b/src/pacman/upgrade.c @@ -55,6 +55,8 @@ int pacman_upgrade(alpm_list_t *targets) if(strstr(i->data, "://")) { char *str = alpm_fetch_pkgurl(i->data); if(str == NULL) { + pm_fprintf(stderr, PM_LOG_ERROR, "'%s': %s\n", + (char *)i->data, alpm_strerrorlast()); return(1); } else { free(i->data); -- cgit v1.2.3-70-g09d2