Skip to content

Commit 908431d

Browse files
committed
ocf-shellfuncs: make ocf_is_bash4() detect Bash v4 or greater (which it was supposed to according to the comments)
1 parent be09923 commit 908431d

1 file changed

Lines changed: 9 additions & 4 deletions

File tree

heartbeat/ocf-shellfuncs.in

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -907,13 +907,18 @@ ocf_unique_rundir()
907907
# NB: FD 9 may be used for tracing with bash >= v4 in case
908908
# OCF_TRACE_FILE is set to a path.
909909
#
910-
ocf_is_bash4() {
910+
ocf_bash_has_xtracefd() {
911911
echo "$SHELL" | grep bash > /dev/null &&
912-
[ ${BASH_VERSINFO[0]} = "4" ]
912+
[ ${BASH_VERSINFO[0]} -ge 4 ]
913+
}
914+
# for backwards compatibility
915+
ocf_is_bash4() {
916+
ocf_bash_has_xtracefd
917+
return $?
913918
}
914919
ocf_trace_redirect_to_file() {
915920
local dest=$1
916-
if ocf_is_bash4; then
921+
if ocf_bash_has_xtracefd; then
917922
exec 9>$dest
918923
BASH_XTRACEFD=9
919924
else
@@ -922,7 +927,7 @@ ocf_trace_redirect_to_file() {
922927
}
923928
ocf_trace_redirect_to_fd() {
924929
local fd=$1
925-
if ocf_is_bash4; then
930+
if ocf_bash_has_xtracefd; then
926931
BASH_XTRACEFD=$fd
927932
else
928933
exec 2>&$fd

0 commit comments

Comments
 (0)