commit:     3c7f54101cfaf566572d37de98e0c5ba4743270b
Author:     Kerin Millar <kfm <AT> plushkava <DOT> net>
AuthorDate: Sat Feb 11 07:20:06 2023 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sun Feb 12 06:53:20 2023 +0000
URL:        
https://gitweb.gentoo.org/proj/gentoo-functions.git/commit/?id=3c7f5410

Guard against errexit in _eend()

Further relief is thus duly administered to the cult of set -e.

Signed-off-by: Kerin Millar <kfm <AT> plushkava.net>
Signed-off-by: Sam James <sam <AT> gentoo.org>

 functions.sh | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/functions.sh b/functions.sh
index 33ef26e..6092841 100644
--- a/functions.sh
+++ b/functions.sh
@@ -230,14 +230,15 @@ _eend()
        local retval="${1:-0}" efunc="${2:-eerror}" msg
        shift 2
 
-       if [ "${retval}" = "0" ]; then
-               yesno "${EINFO_QUIET}" && return 0
-               msg="${BRACKET}[ ${GOOD}ok${BRACKET} ]${NORMAL}"
-       else
-               if [ -n "$*" ] ; then
-                       ${efunc} "$*"
+       if [ "${retval}" != "0" ]; then
+               if [ -n "$*" ]; then
+                       "${efunc}" "$*"
                fi
                msg="${BRACKET}[ ${BAD}!!${BRACKET} ]${NORMAL}"
+       elif yesno "${EINFO_QUIET}"; then
+               return 0
+       else
+               msg="${BRACKET}[ ${GOOD}ok${BRACKET} ]${NORMAL}"
        fi
 
        if yesno "${RC_ENDCOL}"; then

Reply via email to