]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
ctdb-scripts: Avoid ShellCheck warning SC2162
authorMartin Schwenke <mschwenke@ddn.com>
Sun, 18 Jun 2023 23:43:33 +0000 (09:43 +1000)
committerVolker Lendecke <vl@samba.org>
Thu, 30 May 2024 11:42:30 +0000 (11:42 +0000)
  SC2162 read without -r will mangle backslashes.

Signed-off-by: Martin Schwenke <mschwenke@ddn.com>
Reviewed-by: Volker Lendecke <vl@samba.org>
ctdb/config/statd-callout

index 32642a73653502705d9bf6e9362eb201727d569d..b37ffe218f0b3bb0d377981bf6440dc487f4ac84 100755 (executable)
@@ -73,7 +73,7 @@ send_notifies()
        _state_even=$(($(date '+%s') / 2 * 2))
 
        _prev=""
-       while read _sip _cip; do
+       while read -r _sip _cip; do
                # NOTE: Consider optimising smnotify to read all the
                # data from stdin and then run it in the background.
 
@@ -99,7 +99,7 @@ send_notifies()
 
 delete_records()
 {
-       while read _sip _cip; do
+       while read -r _sip _cip; do
                _key="statd-state@${_sip}@${_cip}"
                echo "\"${_key}\" \"\""
        done | $CTDB ptrans "ctdb.tdb"
@@ -124,7 +124,7 @@ add-client)
        # shellcheck disable=SC2034
        $CTDB ip -X |
                tail -n +2 |
-               while IFS="|" read x sip node x; do
+               while IFS="|" read -r x sip node x; do
                        [ "$node" = "$pnn" ] || continue # not us
                        key="statd-state@${sip}@${cip}"
                        echo "\"${key}\" \"${date}\"" >"$key"
@@ -139,7 +139,7 @@ del-client)
        # shellcheck disable=SC2034
        $CTDB ip -X |
                tail -n +2 |
-               while IFS="|" read x sip node x; do
+               while IFS="|" read -r x sip node x; do
                        [ "$node" = "$pnn" ] || continue # not us
                        key="statd-state@${sip}@${cip}"
                        echo "\"${key}\" \"\"" >"$key"
@@ -247,7 +247,7 @@ notify)
        # There's nothing else we can do with them at this stage.
        echo "$ctdb_all_ips" |
                awk -v pnn="$pnn" 'pnn != $2 { print $1 }' |
-               while read sip; do
+               while read -r sip; do
                        rm -f "statd-state@${sip}@"*
                done
        ;;