In order to eliminate the possibility of integer overflay, replace things like
authorZac Medico <zmedico@gentoo.org>
Sun, 29 Mar 2009 04:09:11 +0000 (04:09 -0000)
committerZac Medico <zmedico@gentoo.org>
Sun, 29 Mar 2009 04:09:11 +0000 (04:09 -0000)
((ret+=$?)) with ((ret|=$?)). Thanks to zong_sharo for the suggestion.

svn path=/main/trunk/; revision=13242

12 files changed:
bin/ebuild-helpers/dobin
bin/ebuild-helpers/dodoc
bin/ebuild-helpers/doexe
bin/ebuild-helpers/doins
bin/ebuild-helpers/dolib
bin/ebuild-helpers/doman
bin/ebuild-helpers/domo
bin/ebuild-helpers/dosbin
bin/ebuild-helpers/dosed
bin/ebuild-helpers/ecompress
bin/ebuild-helpers/ecompressdir
bin/ebuild-helpers/prepallman

index 958a37feeeb39387018bd7f1bd892062328851fe..87b773f833908f93d4af6b3f908b3ee5fcd27189 100755 (executable)
@@ -23,7 +23,7 @@ for x in "$@" ; do
                echo "!!! ${0##*/}: $x does not exist" 1>&2
                false
        fi
-       ((ret+=$?))
+       ((ret|=$?))
 done
 
 exit ${ret}
index adf49d04f79c7f930b927fa3d114b2731ce1eb60..04275703767dbc440770d6962083415326c25a0c 100755 (executable)
@@ -21,7 +21,7 @@ for x in "$@" ; do
                ecompress --queue "${dir}/${x##*/}"
        elif [ ! -e "${x}" ] ; then
                echo "!!! ${0##*/}: $x does not exist" 1>&2
-               ((++ret))
+               ((ret|=1))
        fi
 done
 
index a6d679d07991bccc82bda236d9896dcd6ad67e1c..00f43d0c4210c0ec8cfa8d1fc5fe4df6ac293974 100755 (executable)
@@ -35,7 +35,7 @@ for x in "$@" ; do
                echo "!!! ${0##*/}: $mysrc does not exist" 1>&2
                false
        fi
-       ((ret+=$?))
+       ((ret|=$?))
 done
 
 rm -rf "$TMP"
index 8c06bfd9ae298a81b55c279ce4f7c2128af7a0ba..82f0bf3b60fdd21d0e5b589b1b7a2518cf477d09 100755 (executable)
@@ -89,9 +89,9 @@ for x in "$@" ; do
                        mv "$TMP/1/$x_orig" "$x"
                fi
                while popd >/dev/null 2>&1 ; do true ; done
-               ((++success))
+               ((success|=1))
        else
-               _doins "${x}" && ((++success))
+               _doins "${x}" && ((success|=1))
        fi
 done
 rm -rf "$TMP"
index 6c6628bda2b4e8798bf4a61fc636fbf41a2f66c6..a158ecc04694fb2194ef03daf57e1defe57d2f63 100755 (executable)
@@ -35,7 +35,7 @@ for x in "$@" ; do
                echo "!!! ${0##*/}: ${x} does not exist" 1>&2
                false
        fi
-       ((ret+=$?))
+       ((ret|=$?))
 done
 
 exit ${ret}
index 48abc39fd1eae00f01ebf3e22caea86734d71dca..eb1f3114eb1db77826499e6d9d8819c6895b91bd 100755 (executable)
@@ -48,14 +48,14 @@ for x in "$@" ; do
                        fi
 
                        install -m0644 "${x}" "${D}/usr/share/man/${mandir}/${name}"
-                       ((ret+=$?))
+                       ((ret|=$?))
                elif [[ ! -e ${x} ]] ; then
                        echo "!!! ${0##*/}: $x does not exist" 1>&2
-                       ((++ret))
+                       ((ret|=1))
                fi
        else
                vecho "doman: '${x}' is probably not a man page; skipping" 1>&2
-               ((++ret))
+               ((ret|=1))
        fi
 done
 
index f2ad3eaea0cbd303071dd90b0f2f087624b7bbf9..88570c69af67eac942a9c389e3a80ff59841598e 100755 (executable)
@@ -26,7 +26,7 @@ for x in "$@" ; do
                echo "!!! ${0##*/}: $x does not exist" 1>&2
                false
        fi
-       ((ret+=$?))
+       ((ret|=$?))
 done
 
 exit $ret
index c9e85c0b80d5fe09dcaa3eecebfeba2b6495d8ed..e850701e78886d1dc5f1b55e8e40a1c39a60193c 100755 (executable)
@@ -21,7 +21,7 @@ for x in "$@" ; do
                echo "!!! ${0##*/}: ${x} does not exist" 1>&2
                false
        fi
-       ((ret+=$?))
+       ((ret|=$?))
 done
 
 exit ${ret}
index abcb15a7919c473bce2b4dfb8378a6d5bc709c6a..0510703faa9325046275f31bbfe4307d27dae447 100755 (executable)
@@ -22,7 +22,7 @@ for x in "$@" ; do
                        echo "${y} is not a regular file!" >&2
                        false
                fi
-               ((ret+=$?))
+               ((ret|=$?))
        else
                mysed="${x}"
        fi
@@ -30,7 +30,7 @@ done
 
 if [ $file_found = 0 ] ; then
        echo "!!! ${0##*/}: $y does not exist" 1>&2
-       ((ret+=1))
+       ((ret|=1))
 fi
 
 exit $ret
index 6fdde5719d75bd8afd974da5d1e47f03cdd52778..8b4fb98a3a071a329d505871d61f2411bd116fcf 100755 (executable)
@@ -75,7 +75,7 @@ case $1 in
                for x in "$@" ; do
                        [[ ${x##*.} =~ $mask_ext_re ]] && continue
                        filtered_args[$i]=$x
-                       (( i++ ))
+                       ((i|=1))
                done
                [ $i -eq 0 ] && exit 0
                set -- "${filtered_args[@]}"
index 4dd35e549d0994e6a932921c03c994596d65a209..297b46777a2225d88812bff1d8bfd2b41da344d3 100755 (executable)
@@ -54,7 +54,7 @@ funk_up_dir() {
 
        # first we act on all the files
        find "${dir}" -type f ${negate} -iname '*'${suffix} -print0 | ${XARGS} -0 ${binary}
-       ((ret+=$?))
+       ((ret|=$?))
 
        find "${dir}" -type l -print0 | \
        while read -d $'\0' brokenlink ; do
@@ -67,7 +67,7 @@ funk_up_dir() {
                [[ ${act} == "compress" ]] \
                        && ln -snf "${newdest}" "${brokenlink}${suffix}" \
                        || ln -snf "${newdest}" "${brokenlink%${suffix}}"
-               ((ret+=$?))
+               ((ret|=$?))
        done
 }
 
index 747ed1fac511bc3a22921254e08e0545bf78691a..c9e1bdf4a37baa90ec7dcc6bb92701056dc73da3 100755 (executable)
@@ -11,7 +11,7 @@ find "${D}" -type d -name man > "${T}"/prepallman.filelist
 while read mandir ; do
        mandir=${mandir#${D}}
        prepman "${mandir%/man}"
-       ((ret+=$?))
+       ((ret|=$?))
 done < "${T}"/prepallman.filelist
 
 exit ${ret}