diff options
Diffstat (limited to 'remote')
| -rw-r--r-- | remote/includes/binutil.inc | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/remote/includes/binutil.inc b/remote/includes/binutil.inc index 906b6cc2..73371c25 100644 --- a/remote/includes/binutil.inc +++ b/remote/includes/binutil.inc @@ -136,12 +136,14 @@ get_link_chain() { # sanity checks if [[ "$1" == /* ]]; then - [ -e $1 ] || perror "get_link_chain: no such file: $1" + if [ ! -e $1 -a ! -L $1 ]; then + perror "'$1' is a link but its target '$LINK_TARGET' is not in '${LOCALSEARCHDIR}'" + fi else perror "get_link_chain() requires absolute paths, given: $1" fi if [ $# == 2 ] ; then - [ ! -d $2 ] && perror "get_link_chain: $2 is not a directory." + [ ! -d $2 ] && perror "get_link_chain: '$2' is not a directory. Local search can't work..." # got a prefix local PREFIX=$(readlink -f $2) else @@ -184,7 +186,11 @@ get_link_chain() { if [ "x$PREFIX" != "x" -a "x$PREFIX" != "xnotset" ]; then if [ "x${LINK#$PREFIX}" == "x${LINK}" ]; then # prefix was not in the link - echo "$LINK" + if [ ! -e "$LINK" ]; then + [ -e "$PREFIX/$LINK" ] && echo "./$LINK" + else + echo "$LINK" + fi else # prefix was in the link echo ./"${LINK#$PREFIX}" @@ -206,8 +212,7 @@ get_link_chain() { # - libc.so, ld-linux.so # list_basic_libs() { - for i in $(ldd ${SHELL}) - do + for i in $(ldd ${SHELL}); do [ $(echo $i | grep '^/' | grep -c ld) -eq 1 -o $(echo $i | grep '^/' | grep -c libc.so) -eq 1 ] && get_link_chain $i done } |
