Skip to content

Commit

Permalink
ctdb-scripts: Avoid shellcheck warnings SC2030, SC2031 (subshell vari…
Browse files Browse the repository at this point in the history
…ables)

SC2030: Modification of VAR is local (to subshell caused by (..) group).
SC2031: VAR was modified in a subshell. That change might be lost.

Fix a related, incorrect comment.

Signed-off-by: Martin Schwenke <[email protected]>
Reviewed-by: Amitay Isaacs <[email protected]>
  • Loading branch information
martin-schwenke authored and Amitay Isaacs committed Jul 21, 2016
1 parent 0ea90f6 commit efc9af2
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion ctdb/config/events.d/60.nfs
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,9 @@ nfs_check_service ()
{
_progname="$1"

# This sub-shell is created to intentionally limit the scope of
# variable values read from the .check files.
# shellcheck disable=SC2030
(
# Subshell to restrict scope variables...

Expand Down Expand Up @@ -166,7 +169,10 @@ nfs_check_service ()
) || exit 1
}

# Uses: stop_service, start_service, debug_stuck_threads
# Uses: service_stop_cmd, service_start_cmd, service_debug_cmd
# This function is called within the sub-shell that shellcheck thinks
# loses the above variable values.
# shellcheck disable=SC2031
nfs_restart_service ()
{
if [ -z "$service_stop_cmd" -o -z "$service_start_cmd" ] ; then
Expand Down

0 comments on commit efc9af2

Please sign in to comment.