chbg: avoid the TOCTOU race
This commit is contained in:
2
bin/chbg
2
bin/chbg
@@ -14,7 +14,7 @@ finput=$1
|
||||
|
||||
read -r fw fh <<< "$fsize"
|
||||
(( fw > 3840 && fh > 2160 )) && {
|
||||
finput="$(mktemp --dry-run).webp"
|
||||
finput=$(mktemp "${TMPDIR:-/tmp}/chbg.XXXXXXXX.webp")
|
||||
trap 'rm -f "$finput"' EXIT
|
||||
echo "WARNING: image too large, resizing ..."
|
||||
# echo "DEBUG: resized image at $finput"
|
||||
|
||||
Reference in New Issue
Block a user