desktop.eclass: domenu, fix potential overflow in exit status
authorMichał Górny <mgorny@gentoo.org>
Thu, 26 Jul 2018 11:09:59 +0000 (13:09 +0200)
committerMichał Górny <mgorny@gentoo.org>
Thu, 9 Aug 2018 14:08:38 +0000 (16:08 +0200)
While increasing exit status for each failure may seem brilliant
at first, it serves no purpose and has an overflow risk.  For example,
if domenu counted 256 failures, the exit status would be truncated to 0
(success).

eclass/desktop.eclass

index 1684a21d21f790c413739969002a3d3fecc49312..8f2c6d55c2932e154c04d2fe39325642b5d571b2 100644 (file)
@@ -251,11 +251,11 @@ domenu() {
                if [[ -d ${i} ]] ; then
                        for j in "${i}"/*.desktop ; do
                                doins "${j}"
-                               ((ret+=$?))
+                               ((ret|=$?))
                        done
                else
                        doins "${i}"
-                       ((ret+=$?))
+                       ((ret|=$?))
                fi
        done
        exit ${ret}