From 8a4b143bf31a6bf3a8cd743cfc30dad1fe87e472 Mon Sep 17 00:00:00 2001 From: Juan RP Date: Sun, 6 May 2012 09:09:09 +0200 Subject: [PATCH] Show a proper error message if download of a binpkg fails in a transaction. --- include/xbps_api.h | 2 +- lib/transaction_commit.c | 8 +++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/include/xbps_api.h b/include/xbps_api.h index 5d8c67fe..0be3d9a8 100644 --- a/include/xbps_api.h +++ b/include/xbps_api.h @@ -56,7 +56,7 @@ */ #define XBPS_PKGINDEX_VERSION "1.4" -#define XBPS_API_VERSION "20120412" +#define XBPS_API_VERSION "20120506" #define XBPS_VERSION "0.16" /** diff --git a/lib/transaction_commit.c b/lib/transaction_commit.c index aa985491..d9412c61 100644 --- a/lib/transaction_commit.c +++ b/lib/transaction_commit.c @@ -111,7 +111,7 @@ download_binpkgs(struct xbps_handle *xhp, prop_object_iterator_t iter) { prop_object_t obj; const char *pkgver, *repoloc, *filen, *trans; - const char *pkgname, *version; + const char *pkgname, *version, *fetchstr; char *binfile; int rv = 0; @@ -163,11 +163,13 @@ download_binpkgs(struct xbps_handle *xhp, prop_object_iterator_t iter) */ rv = xbps_fetch_file(binfile, xhp->cachedir, false, NULL); if (rv == -1) { + fetchstr = xbps_fetch_error_string(); xbps_set_cb_state(XBPS_STATE_DOWNLOAD_FAIL, - errno, pkgname, version, + fetchLastErrCode != 0 ? fetchLastErrCode : errno, + pkgname, version, "%s: [trans] failed to download binary package " "`%s' from `%s': %s", pkgver, filen, repoloc, - strerror(errno)); + fetchstr ? fetchstr : strerror(errno)); free(binfile); break; }