commit:     77ada7caca7d68e40cc8df6f026183474b250d4f
Author:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
AuthorDate: Sat Apr  4 22:36:59 2015 +0000
Commit:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
CommitDate: Sat Apr  4 22:36:59 2015 +0000
URL:        https://gitweb.gentoo.org/proj/hardened-dev.git/commit/?id=77ada7ca

sys-apps/ldconfig: Bug #545006.

Package-Manager: portage-2.2.14
Manifest-Sign-Key: 0xF52D4BBA

 sys-apps/ldconfig/files/ldconfig-0.1 | 36 ++++++++++++++++++------------------
 1 file changed, 18 insertions(+), 18 deletions(-)

diff --git a/sys-apps/ldconfig/files/ldconfig-0.1 
b/sys-apps/ldconfig/files/ldconfig-0.1
index c5ec1df..55db851 100644
--- a/sys-apps/ldconfig/files/ldconfig-0.1
+++ b/sys-apps/ldconfig/files/ldconfig-0.1
@@ -10,16 +10,6 @@ fi
 
 LDSO_CONF_DIR=$(dirname $LDSO_CONF)
 
-LDSO_PATH=$(ls /lib/ld-musl-*.so.1)
-if [[ ! -e $LDSO_PATH ]]; then
-       echo "$LDSO_PATH not found" >&2
-       exit 1
-fi
-
-LDSO_ARCH=$(basename $LDSO_PATH)
-LDSO_NAME=${LDSO_ARCH%.so.1}
-ETC_LDSO_PATH=/etc/${LDSO_NAME}.path
-
 VERBOSE=0
 
 get_options() {
@@ -33,7 +23,7 @@ get_options() {
                        ROOT=$OPTARG
                        ;;
                f)
-                       LDSOCONF=$OPTARG
+                       LDSO_CONF=$OPTARG
                        ;;
                \?)
                        echo "Invalid option: -$opt" >&2
@@ -106,7 +96,7 @@ read_ldso_conf() {
                                fi
                        fi
                done
-       done < $LDSO_CONF
+       done < $1
 
        echo $drs
 }
@@ -121,16 +111,26 @@ sanitize() {
 }
 
 get_options "$@"
-drs=$(read_ldso_conf)
+drs=$(read_ldso_conf "$LDSO_CONF")
+for f in $LDSO_CONF.d/*; do
+       drs="$drs $(read_ldso_conf "$f")"
+done
 drs=$(sanitize $drs)
 
+#LDSO_PATH=$(readelf -l /bin/bash | grep -o '\/lib\/ld-musl-.*\.so\.1')
+LDSO_PATH=$(ls /lib/ld-musl-*.so.1)
+if [[ ! -e $LDSO_PATH ]]; then
+       echo "$LDSO_PATH not found" >&2
+       exit 1
+fi
+
+LDSO_ARCH=$(basename $LDSO_PATH)
+LDSO_NAME=${LDSO_ARCH%.so.1}
+ETC_LDSO_PATH=/etc/${LDSO_NAME}.path
+
 X=$(mktemp --tmpdir=/tmp ${LDSO_NAME}.XXXXXX)
-cat << EOF > $X
-# $ETC_LDSO_PATH autogenerated by env-update; make all changes to
-# contents of /etc/env.d directory
-EOF
 for d in $drs; do
        echo $d >> $X
 done
+chmod 644 $X
 mv $X $ETC_LDSO_PATH
-

Reply via email to