about summary refs log tree commit diff
path: root/elf
diff options
context:
space:
mode:
Diffstat (limited to 'elf')
-rw-r--r--elf/Makefile2
-rw-r--r--elf/ldd.bash.in32
-rw-r--r--elf/ldd.sh.in34
3 files changed, 42 insertions, 26 deletions
diff --git a/elf/Makefile b/elf/Makefile
index 55094e3939..4666919478 100644
--- a/elf/Makefile
+++ b/elf/Makefile
@@ -56,7 +56,7 @@ install-bin	= ldd
 endif
 
 ifeq (yes,$(has-ldconfig))
-extra-objs	= ldconfig.o
+extra-objs	+= ldconfig.o
 install-rootsbin = ldconfig
 
 $(objpfx)ldconfig: $(objpfx)ldconfig.o
diff --git a/elf/ldd.bash.in b/elf/ldd.bash.in
index d174709380..d4ea3310fd 100644
--- a/elf/ldd.bash.in
+++ b/elf/ldd.bash.in
@@ -79,17 +79,20 @@ case $# in
   *) file="./$1" ;;
   esac
   if test ! -f "$file"; then
-    echo "${file}:" $"no such file"
+    echo "ldd: ${file}:" $"no such file"
     exit 1
-  else
+  elif test -r "$file"; then
     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
-    else
-      echo $"	not a dynamic executable"
-      exit 1
-    fi
+    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 $"ldd: error: you do not have read permission for" "\`$file'"
+    exit 1
   fi
   exit ;;
 *)
@@ -102,17 +105,20 @@ case $# in
     *) 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'"
+    elif 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 $"ldd: error: you do not have read permission for" "\`$file'"
+      result=1
     fi
   done
 esac
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