commit:     1390060f37a01418dd4e46160abb4e4bc490ec16
Author:     Kerin Millar <kfm <AT> plushkava <DOT> net>
AuthorDate: Sun Jun 15 18:37:38 2025 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Tue Jun 17 03:00:37 2025 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=1390060f

emerge-webrsync: have check_file_signature() handle exit codes flexibly

Presently, the check_file_signature() function requires for the 'r'
variable to contain a meaningful exit status code to be able to
determine whether to invoke die(). Instead, employ the ${r=$?} form of
parameter expansion so that the value of the '?' parameter is
substituted and assigned for cases where 'r' hasn't been set.

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

 bin/emerge-webrsync | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/bin/emerge-webrsync b/bin/emerge-webrsync
index 71f01f8708..25ed348c96 100755
--- a/bin/emerge-webrsync
+++ b/bin/emerge-webrsync
@@ -344,8 +344,7 @@ check_file_signature() {
                        ;;&
                1)
                        check_file_signature_gemato "${signature}" "${file}"
-                       r=$?
-                       if [[ ${r} -eq 127 ]] ; then
+                       if [[ ${r=$?} -eq 127 ]] ; then
                                ewarn "Falling back to gpg as gemato is not 
installed"
                                check_file_signature_gpg_unwrapped 
"${signature}" "${file}"
                                r=$?
@@ -353,10 +352,9 @@ check_file_signature() {
                        ;;
                2)
                        check_file_signature_gpg_unwrapped "${signature}" 
"${file}"
-                       r=$?
        esac
 
-       if [[ ${r} != 0 ]] ; then
+       if [[ ${r=$?} != 0 ]] ; then
                eerror "Error occurred in check_file_signature: ${r}. Aborting."
                die "Verification error occured."
        fi

Reply via email to