From a0ed1203f212579c12ff325c9f0f2a65816b4b13 Mon Sep 17 00:00:00 2001 From: Richard T Bonhomme Date: Wed, 20 Apr 2022 22:06:25 +0100 Subject: [PATCH] Priorise trap above vars_setup() vars_setup() has become more complex, therefore, trap should be set earlier. Signed-off-by: Richard T Bonhomme --- easyrsa3/easyrsa | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/easyrsa3/easyrsa b/easyrsa3/easyrsa index c7c7871..7820c52 100755 --- a/easyrsa3/easyrsa +++ b/easyrsa3/easyrsa @@ -2981,6 +2981,16 @@ subjectAltName = $val" ;; shift done +# Register cleanup on EXIT +trap "cleanup" EXIT +# When SIGHUP, SIGINT, SIGQUIT, SIGABRT and SIGTERM, +# explicitly exit to signal EXIT (non-bash shells) +trap "exit 1" 1 +trap "exit 2" 2 +trap "exit 3" 3 +trap "exit 6" 6 +trap "exit 14" 15 + # Set cmd now because vars_setup needs to know if this is init-pki cmd="$1" [ -n "$1" ] && shift # scrape off command @@ -2997,16 +3007,6 @@ esac # Intelligent env-var detection and auto-loading: vars_setup -# Register cleanup on EXIT -trap "cleanup" EXIT -# When SIGHUP, SIGINT, SIGQUIT, SIGABRT and SIGTERM, -# explicitly exit to signal EXIT (non-bash shells) -trap "exit 1" 1 -trap "exit 2" 2 -trap "exit 3" 3 -trap "exit 6" 6 -trap "exit 14" 15 - # determine how we were called, then hand off to the function responsible case "$cmd" in init-pki|clean-all)