In the suidctl code, move the addwrite call out of the loop. Thanks to ferringb.
authorZac Medico <zmedico@gentoo.org>
Fri, 29 Feb 2008 22:58:15 +0000 (22:58 -0000)
committerZac Medico <zmedico@gentoo.org>
Fri, 29 Feb 2008 22:58:15 +0000 (22:58 -0000)
svn path=/main/trunk/; revision=9399

bin/misc-functions.sh

index c9a1383cf92d17384caefa849079485ee3e6e772..67eaa292eb9591d2eb177121c58e8c27ec262f0a 100755 (executable)
@@ -491,6 +491,10 @@ preinst_suid_scan() {
        # total suid control.
        if hasq suidctl $FEATURES; then
                sfconf=${PORTAGE_CONFIGROOT}etc/portage/suidctl.conf
+               # sandbox prevents us from writing directly
+               # to files outside of the sandbox, but this
+               # can easly be bypassed using the addwrite() function
+               addwrite "${sfconf}"
                vecho ">>> Performing suid scan in ${D}"
                for i in $(find "${D}" -type f \( -perm -4000 -o -perm -2000 \) ); do
                        if [ -s "${sfconf}" ]; then
@@ -504,10 +508,6 @@ preinst_suid_scan() {
                                        ls_ret=$(ls -ldh "${i}")
                                        chmod ugo-s "${i}"
                                        grep "^#${i/${D}}$" "${sfconf}" > /dev/null || {
-                                               # sandbox prevents us from writing directly
-                                               # to files outside of the sandbox, but this
-                                               # can easly be bypassed using the addwrite() function
-                                               addwrite "${sfconf}"
                                                vecho ">>> Appending commented out entry to ${sfconf} for ${PF}"
                                                echo "## ${ls_ret%${D}*}${ls_ret#*${D}}" >> "${sfconf}"
                                                echo "#${i/${D}}" >> "${sfconf}"