Fix 10 HIGH integer comparisons in backup/maintenance/security modules

FIXES:
enable-cphulk.sh:
- Line 234: $file_ip_count → ${file_ip_count:-0}
- Line 333: $FAILED → ${FAILED:-0}

cleanup-toolkit-data.sh:
- Line 209: $cleaned_size → ${cleaned_size:-0} (3 instances)
- Line 236: $missing → ${missing:-0}

acronis-update.sh:
- Line 229: $UPGRADE_EXIT_CODE → ${UPGRADE_EXIT_CODE:-0}

acronis-install.sh:
- Line 301: $INSTALL_EXIT_CODE → ${INSTALL_EXIT_CODE:-0}

acronis-logs.sh:
- Line 64: $log_count → ${log_count:-0}
- Line 215: $old_logs → ${old_logs:-0}

IMPACT:
- Prevents errors in backup/maintenance scripts
- Safe defaults for all exit code checks
- More robust error handling

PROGRESS:
- Fixed 57+ integer comparison issues total
- Only 3 HIGH issues remaining!
- Total issues: 23 (was 41 originally)
This commit is contained in:
cschantz
2025-12-03 20:14:37 -05:00
parent 4757ae591d
commit c1eee9de66
5 changed files with 10 additions and 10 deletions
+4 -4
View File
@@ -206,11 +206,11 @@ echo -e "${CYAN}─────────────────────
echo ""
# Convert size to human readable
if [ $cleaned_size -lt 1024 ]; then
if [ "${cleaned_size:-0}" -lt 1024 ]; then
size_human="${cleaned_size}B"
elif [ $cleaned_size -lt 1048576 ]; then
elif [ "${cleaned_size:-0}" -lt 1048576 ]; then
size_human="$((cleaned_size / 1024))KB"
elif [ $cleaned_size -lt 1073741824 ]; then
elif [ "${cleaned_size:-0}" -lt 1073741824 ]; then
size_human="$((cleaned_size / 1048576))MB"
else
size_human="$((cleaned_size / 1073741824))GB"
@@ -233,7 +233,7 @@ missing=0
[ -d "/var/lib/server-toolkit" ] && { echo -e "${YELLOW}Warning: /var/lib/server-toolkit still exists${NC}"; ((missing++)); }
[ -d "/tmp/live-monitor-current" ] && { echo -e "${YELLOW}Warning: /tmp/live-monitor-current still exists${NC}"; ((missing++)); }
if [ $missing -gt 0 ]; then
if [ "${missing:-0}" -gt 0 ]; then
echo ""
echo -e "${YELLOW}Some directories could not be removed (may be in use)${NC}"
echo "Try stopping any running toolkit scripts and run cleanup again."