]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
ctdb-scripts: Avoid shellcheck warnings SC2030, SC2031 (subshell variables)
authorMartin Schwenke <martin@meltin.net>
Wed, 6 Jul 2016 06:13:27 +0000 (16:13 +1000)
committerAmitay Isaacs <amitay@samba.org>
Thu, 21 Jul 2016 00:24:26 +0000 (02:24 +0200)
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 <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
ctdb/config/events.d/60.nfs

index 6b2bdbc57586b94c9a167b146f798656b3f33ce7..189e2f6203f2e6131894ab81aa148541c532bc5b 100755 (executable)
@@ -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...
 
@@ -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