From 1ddba87493a1114011d4dcd76b08ee7e0775caea Mon Sep 17 00:00:00 2001 From: Stefano Stabellini Date: Tue, 14 Apr 2020 13:38:10 -0700 Subject: Use stat -L instead of stat, file -L instead of file Use stat -L and file -L so that the two tools follow symlinks correctly. Also fix an error in check_file_type: the error function is called cleanup_and_return_err, not clean_up_and_err_out. Signed-off-by: Stefano Stabellini Reviewed-by: Brian Woods --- scripts/uboot-script-gen | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'scripts/uboot-script-gen') diff --git a/scripts/uboot-script-gen b/scripts/uboot-script-gen index 9e81ad8..3e167b1 100644 --- a/scripts/uboot-script-gen +++ b/scripts/uboot-script-gen @@ -105,7 +105,7 @@ function device_tree_editing() function add_size() { local filename=$1 - local size=`stat --printf="%s" $filename` + local size=`stat -L --printf="%s" $filename` memaddr=$(( $memaddr + $size + $offset - 1)) memaddr=$(( $memaddr & ~($offset - 1) )) memaddr=`printf "0x%X\n" $memaddr` @@ -138,11 +138,11 @@ function check_file_type() type="executable\|data" fi - file $filename | grep "$type" &> /dev/null + file -L $filename | grep "$type" &> /dev/null if test $? != 0 then echo Wrong file type "$filename". It should be "$type", exiting. - clean_up_and_err_out + cleanup_and_return_err fi } @@ -157,7 +157,7 @@ function check_compressed_file_type() cleanup_and_return_err fi - file $filename | grep "gzip compressed data" &> /dev/null + file -L $filename | grep "gzip compressed data" &> /dev/null if test $? == 0 then local tmp=`mktemp` -- cgit v1.2.3