mirror of
https://github.com/Mbed-TLS/mbedtls.git
synced 2025-02-13 15:40:58 +00:00
Avoid recursion for relative paths
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
This commit is contained in:
parent
c02c5b1520
commit
4c4f1f1428
@ -22,9 +22,16 @@
|
||||
# be silenced, e.g. " --version | test ". In this example, "make lib test" will
|
||||
# not be silent, but "make lib" will be.
|
||||
|
||||
# Locate original tool
|
||||
TOOL_WITH_PATH=$(dirname "$0")/$TOOL
|
||||
ORIGINAL_TOOL=$(type -ap "${TOOL}" | grep -v -Fx "$TOOL_WITH_PATH" | head -n1)
|
||||
# Function to normalise paths
|
||||
get_real_filename() {
|
||||
leafname="$(basename "$1")"
|
||||
( cd $(dirname "$1"); echo "$(pwd)/$leafname" )
|
||||
}
|
||||
|
||||
# Normalise path to wrapper script
|
||||
WRAPPER_WITH_PATH=$(get_real_filename "$0")
|
||||
# Identify original tool (compare normalised path to WRAPPER_WITH_PATH to avoid recursively calling the same wrapper script)
|
||||
ORIGINAL_TOOL="$(for p in $(type -ap "$TOOL"); do get_real_filename "$p" ; done | grep -v -Fx "$WRAPPER_WITH_PATH" | head -n1)"
|
||||
|
||||
print_quoted_args() {
|
||||
# similar to printf '%q' "$@"
|
||||
|
Loading…
x
Reference in New Issue
Block a user