diff options
author | Leah Rowe <leah@libreboot.org> | 2025-09-02 03:22:12 +0100 |
---|---|---|
committer | Leah Rowe <leah@libreboot.org> | 2025-09-02 03:26:26 +0100 |
commit | e05961458953fdf8d55ddd871663a452ef0e8d43 (patch) | |
tree | c8b70c9f8edd71797ce4b9fe6fc93358e73f50f4 /include | |
parent | 934e89510e1e30ab6f8eb40e6cbebd2cfd9b0bf0 (diff) |
get.sh xbget: don't use eval for file/dir checks
the actual code works fine, but it's quite hacky.
there are times when use of eval is acceptable; this
is not one of those times, but i'd used it in this
instance when i was being a bit crazy about code size
reductions during my audits.
Signed-off-by: Leah Rowe <leah@libreboot.org>
Diffstat (limited to 'include')
-rw-r--r-- | include/get.sh | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/include/get.sh b/include/get.sh index a3328454..7c799411 100644 --- a/include/get.sh +++ b/include/get.sh @@ -77,12 +77,13 @@ xbget() [ "$1" = "curl" ] || [ "$1" = "copy" ] || [ "$1" = "git" ] || \ err "Bad dlop (arg 1): xbget $*" - echk="f" && [ "$1" = "git" ] && echk="d" - for url in "$2" "$3"; do [ -n "$url" ] || err "empty URL given in: xbget $*" try_file "$url" "$@" || continue - eval "[ -$echk \"$4\" ] || continue" + case "$1" in + git) [ -d "$4" ] || continue ;; + *) [ -f "$4" ] || continue ;; + esac return 0 # successful download/copy done err "$1 $2 $3 $4: not downloaded"; : |