Sophie

Sophie

distrib > Mageia > 5 > x86_64 > by-pkgid > 004fd25eb1d89e31fc9cddb571328f7f > files > 68

glibc-2.20-21.mga5.src.rpm

diff -p -up glibc-2.9/elf/ldd.bash.in.orig glibc-2.9/elf/ldd.bash.in
--- glibc-2.9/elf/ldd.bash.in.orig	2008-01-02 14:25:22.000000000 -0500
+++ glibc-2.9/elf/ldd.bash.in	2009-01-15 07:47:41.000000000 -0500
@@ -31,6 +31,7 @@ RTLDLIST=@RTLD@
 warn=
 bind_now=
 verbose=
+file_magic_regex="ELF [0-9][0-9]*-bit [LM]SB (shared object|dynamic lib)"
 
 while test $# -gt 0; do
   case "$1" in
@@ -151,8 +152,11 @@ for file do
     echo "ldd: ${file}:" $"not regular file" >&2
     result=1
   elif test -r "$file"; then
+    if eval file -L "$file" 2>/dev/null \
+    | sed 10q | egrep -v "$file_magic_regex" > /dev/null; then
     test -x "$file" || echo 'ldd:' $"\
 warning: you do not have execution permission for" "\`$file'" >&2
+    fi
     RTLD=
     ret=1
     for rtld in ${RTLDLIST}; do
@@ -169,8 +173,14 @@ warning: you do not have execution permi
       # If the program exits with exit code 5, it means the process has been
       # invoked with __libc_enable_secure.  Fall back to running it through
       # the dynamic linker.
-      try_trace "$file"
-      rc=$?
+      if [ ! -x "$file" ] && eval file -L "$file" 2>/dev/null \
+      | sed 10q | egrep "$file_magic_regex" > /dev/null; then
+	try_trace "$RTLD" "$file"
+        rc=$?
+      else
+        try_trace "$file"
+        rc=$?
+      fi
       if [ $rc = 5 ]; then
 	try_trace "$RTLD" "$file"
 	rc=$?