fxsdk: add file size sanity check before sending

This commit is contained in:
Lephenixnoir 2024-07-06 09:59:39 +02:00
parent 181ed5cccd
commit 82c0e0ed67
No known key found for this signature in database
GPG key ID: 1BBA026E13FC0495

View file

@ -311,6 +311,14 @@ fxsdk_send_cp() {
return 1
fi
hh2_bin_files=$(find -maxdepth 1 -name '*-hh2.bin')
# Sanity check for file size
size=$(du -bc ${hh2_bin_files} | tail -n 1 | cut -f1)
if [[ $size -gt 2000000 ]]; then
echo "$TAG WARNING: file (${hh2_bin_files}) is > 2 MB, is that a link bug?" >&2
return
fi
echo "$TAG Running: fxlink -sw ${hh2_bin_files}"
fxlink -sw ${hh2_bin_files}
}