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
+1 -1
View File
@@ -298,7 +298,7 @@ echo -e "${DIM}─────────────────────
echo ""
# Check installation result
if [ $INSTALL_EXIT_CODE -eq 0 ]; then
if [ "${INSTALL_EXIT_CODE:-0}" -eq 0 ]; then
print_success "Installation completed successfully!"
echo ""
+2 -2
View File
@@ -61,7 +61,7 @@ show_log_menu() {
echo -e " Size: ${size} | Modified: ${mod_time}"
done < <(find "$LOG_DIR" -name "*.log" -type f | sort)
if [ $log_count -eq 0 ]; then
if [ "${log_count:-0}" -eq 0 ]; then
echo -e " ${DIM}No log files found${NC}"
fi
fi
@@ -212,7 +212,7 @@ archive_old_logs() {
# Find old logs (older than 30 days)
local old_logs=$(find "$LOG_DIR" -name "*.log" -type f -mtime +30 2>/dev/null | wc -l)
if [ $old_logs -eq 0 ]; then
if [ "${old_logs:-0}" -eq 0 ]; then
echo -e "${GREEN}✓ No old logs found (>30 days)${NC}"
echo ""
press_enter
+1 -1
View File
@@ -226,7 +226,7 @@ case "$method" in
echo ""
# Check result
if [ $UPGRADE_EXIT_CODE -eq 0 ]; then
if [ "${UPGRADE_EXIT_CODE:-0}" -eq 0 ]; then
print_success "Upgrade completed successfully!"
echo ""