From c5b6e916e4ed2e0a7194c8f1f5e8fe0ca2b10c1e Mon Sep 17 00:00:00 2001 From: Yong-an Lu Date: Wed, 9 Nov 2022 09:19:22 +0800 Subject: [PATCH] hijack: roll back signal before func_exit_handler if any function inside func_exit_handle calls exit indirectly, it will lead to infinity recursive calls. Roll back the signal in the beginning of the handler to avoid such cases. Signed-off-by: Yong-an Lu --- case-lib/hijack.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/case-lib/hijack.sh b/case-lib/hijack.sh index c9d1c84e..ca4a1257 100644 --- a/case-lib/hijack.sh +++ b/case-lib/hijack.sh @@ -6,6 +6,9 @@ trap 'func_exit_handler $?' EXIT # Overwrite other functions' exit to perform environment cleanup function func_exit_handler() { + # roll back signal to avoid infinity recursive calls + trap '' EXIT + local exit_status=${1:-0} # call trace