From a42c5504e70efcaa2eca693779a7b21697f344bc Mon Sep 17 00:00:00 2001 From: Castulo Martinez Date: Mon, 2 Jul 2018 17:40:41 -0700 Subject: [PATCH] Fix output message in bundle-add There is a bug in bundle-add that causes the wrong output message to be shown when a bundle fails to be installed due to not being able to download a file that is part of the bundle. This commit fixes the logic so messages are shown correctly. Fixes #511 --- src/bundle.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/bundle.c b/src/bundle.c index 76119916..4f8919de 100644 --- a/src/bundle.c +++ b/src/bundle.c @@ -937,7 +937,14 @@ out: } /* print totals */ - bundles_failed = bundles_requested - bundles_installed - already_installed; + if (ret && bundles_installed != 0) { + /* if this point is reached with a nonzero return code and bundles_installed=0 it means that + * while trying to install the bundles some error occurred which caused the whole installation + * process to be aborted, so none of the bundles got installed. */ + bundles_failed = bundles_requested - already_installed; + } else { + bundles_failed = bundles_requested - bundles_installed - already_installed; + } if (bundles_failed > 0) { ret = EBUNDLE_INSTALL; fprintf(stderr, "Failed to install %i of %i bundles\n", bundles_failed, bundles_requested - already_installed);