about summary refs log tree commit diff
path: root/elf/ldd.sh.in
diff options
context:
space:
mode:
Diffstat (limited to 'elf/ldd.sh.in')
-rw-r--r--elf/ldd.sh.in34
1 files changed, 22 insertions, 12 deletions
diff --git a/elf/ldd.sh.in b/elf/ldd.sh.in
index 4351578b6d..f7c1163890 100644
--- a/elf/ldd.sh.in
+++ b/elf/ldd.sh.in
@@ -77,15 +77,20 @@ Try \`ldd --help' for more information."
   *) file="./$1" ;;
   esac
   if test ! -f "$file"; then
-    echo "${file}: no such file"
+    echo "ldd: ${file}: no such file"
     exit 1
   else
-    test -x "$file" ||
-      echo "warning: you do not have execution permission for \`$file'"
-    if ${RTLD} --verify "$file"; then
-      LD_TRACE_LOADED_OBJECTS=1 exec ${RTLD} ${RELOCS} "$file" || exit 1
+    if test -r "$file"; then
+      test -x "$file" ||
+	echo "ldd: warning: you do not have execution permission for \`$file'"
+      if ${RTLD} --verify "$file"; then
+	LD_TRACE_LOADED_OBJECTS=1 exec ${RTLD} ${RELOCS} "$file" || exit 1
+      else
+	echo '	not a dynamic executable'
+	exit 1
+      fi
     else
-      echo '	not a dynamic executable'
+      echo "ldd: error: you do not have read permission for \`$file'"
       exit 1
     fi
   fi
@@ -100,15 +105,20 @@ Try \`ldd --help' for more information."
     *) file="./$file" ;;
     esac
     if test ! -f "$file"; then
-      echo "${file}: no such file"
+      echo "ldd: ${file}: no such file"
       result=1
     else
-      test -x "$file" ||
-	echo "warning: you do not have execution permission for \`$file'"
-      if ${RTLD} --verify "$file"; then
-	LD_TRACE_LOADED_OBJECTS=1 ${RTLD} ${RELOCS} "$file" || result=1
+      if test -r "$file"; then
+	test -x "$file" || echo "\
+ldd: warning: you do not have execution permission for \`$file'"
+	if ${RTLD} --verify "$file"; then
+	  LD_TRACE_LOADED_OBJECTS=1 ${RTLD} ${RELOCS} "$file" || result=1
+	else
+	  echo '	not a dynamic executable'
+	  result=1
+	fi
       else
-	echo '	not a dynamic executable'
+	echo "ldd: error: you do not have read permission for \`$file'"
 	result=1
       fi
     fi