Merge branch 'luizluca-fix_trap_exit_v2'
Signed-off-by: Eric F Crist <ecrist@secure-computing.net>
This commit is contained in:
commit
942fa82a2a
@ -254,8 +254,7 @@ die() {
|
|||||||
Easy-RSA error:
|
Easy-RSA error:
|
||||||
|
|
||||||
$1" 1>&2
|
$1" 1>&2
|
||||||
clean_temp;
|
exit "${2:-1}"
|
||||||
prog_exit "${2:-1}"
|
|
||||||
} # => die()
|
} # => die()
|
||||||
|
|
||||||
# non-fatal warning output
|
# non-fatal warning output
|
||||||
@ -305,21 +304,15 @@ Type the word '$value' to continue, or any other input to abort."
|
|||||||
exit 9
|
exit 9
|
||||||
} # => confirm()
|
} # => confirm()
|
||||||
|
|
||||||
# remove temp files
|
# remove temp files and do terminal cleanups
|
||||||
clean_temp() {
|
cleanup() {
|
||||||
for f in "$EASYRSA_TEMP_CONF" "$EASYRSA_TEMP_EXT" \
|
for f in "$EASYRSA_TEMP_CONF" "$EASYRSA_TEMP_EXT" \
|
||||||
"$EASYRSA_TEMP_FILE_2" "$EASYRSA_TEMP_FILE_3" "$EASYRSA_TEMP_FILE_4"
|
"$EASYRSA_TEMP_FILE_2" "$EASYRSA_TEMP_FILE_3" "$EASYRSA_TEMP_FILE_4"
|
||||||
do [ -f "$f" ] && rm "$f" 2>/dev/null
|
do [ -f "$f" ] && rm "$f" 2>/dev/null
|
||||||
done
|
done
|
||||||
} # => clean_temp()
|
|
||||||
|
|
||||||
prog_exit() {
|
|
||||||
ESTAT=0
|
|
||||||
[ -n "$1" ] && ESTAT=$1
|
|
||||||
(stty echo 2>/dev/null) || set -o echo
|
(stty echo 2>/dev/null) || set -o echo
|
||||||
echo "" # just to get a clean line
|
echo "" # just to get a clean line
|
||||||
exit "$ESTAT"
|
} # => cleanup()
|
||||||
} # => prog_exit()
|
|
||||||
|
|
||||||
# Make LibreSSL safe config file from OpenSSL config file
|
# Make LibreSSL safe config file from OpenSSL config file
|
||||||
make_ssl_config() {
|
make_ssl_config() {
|
||||||
@ -1625,12 +1618,15 @@ done
|
|||||||
# Intelligent env-var detection and auto-loading:
|
# Intelligent env-var detection and auto-loading:
|
||||||
vars_setup
|
vars_setup
|
||||||
|
|
||||||
# Register clean_temp and prog_exit on SIGHUP, SIGINT, SIGQUIT, and SIGABRT
|
# Register cleanup on EXIT
|
||||||
trap "clean_temp; prog_exit 1" 1
|
trap "cleanup" EXIT
|
||||||
trap "clean_temp; prog_exit 2" 2
|
# When SIGHUP, SIGINT, SIGQUIT, SIGABRT and SIGTERM,
|
||||||
trap "clean_temp; prog_exit 3" 3
|
# explicitly exit to signal EXIT (non-bash shells)
|
||||||
trap "clean_temp; prog_exit 6" 6
|
trap "exit 1" 1
|
||||||
trap "clean_temp; prog_exit 15" 15
|
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
|
# determine how we were called, then hand off to the function responsible
|
||||||
cmd="$1"
|
cmd="$1"
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user