Added cleanup function to remove temporary files on exit.
This commit is contained in:
Alexandre
2026-02-03 21:19:37 +01:00
committed by GitHub
parent 2f8b352ea7
commit 71d0bc565b

View File

@@ -7,8 +7,10 @@ if [[ ! -x "${REAL_IP6TABLES_RESTORE}" ]]; then
fi
cleanup() {
local exit_code=$?
[[ -n "${RULES_FILE:-}" && -f "${RULES_FILE}" ]] && rm -f "${RULES_FILE}"
[[ -n "${SANITIZED_FILE:-}" && -f "${SANITIZED_FILE}" ]] && rm -f "${SANITIZED_FILE}"
return $exit_code
}
trap cleanup EXIT