From 82c0e0ed678029402e03051ed8bf7209e7dd6147 Mon Sep 17 00:00:00 2001 From: Lephenixnoir Date: Sat, 6 Jul 2024 09:59:39 +0200 Subject: [PATCH] fxsdk: add file size sanity check before sending --- fxsdk/fxsdk.sh | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/fxsdk/fxsdk.sh b/fxsdk/fxsdk.sh index 7cb8df6..cc2d253 100755 --- a/fxsdk/fxsdk.sh +++ b/fxsdk/fxsdk.sh @@ -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} }