summaryrefslogtreecommitdiff
path: root/ctdb/config/ctdbd_wrapper
diff options
context:
space:
mode:
authorMartin Schwenke <martin@meltin.net>2016-07-06 17:31:51 +1000
committerAmitay Isaacs <amitay@samba.org>2016-07-21 02:24:26 +0200
commit9255d645f3df9d6451ed0f1382c6752b7bec22ff (patch)
tree3386b557c3c8064ca1111c3483c8e82b68f09d0f /ctdb/config/ctdbd_wrapper
parentf6c25a455a62281fd4bf2e3e74cd0ae4233df132 (diff)
downloadsamba-9255d645f3df9d6451ed0f1382c6752b7bec22ff.tar.gz
ctdb-scripts: Avoid shellcheck warnings SC2046, SC2086 (double-quoting)
SC2046: Quote this to prevent word splitting. SC2086: Double quote to prevent globbing and word splitting. Add some quoting where it makes sense. Use shellcheck directives for false-positives. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
Diffstat (limited to 'ctdb/config/ctdbd_wrapper')
-rwxr-xr-xctdb/config/ctdbd_wrapper10
1 files changed, 6 insertions, 4 deletions
diff --git a/ctdb/config/ctdbd_wrapper b/ctdb/config/ctdbd_wrapper
index 29b015437a1..4d0dde7e0a9 100755
--- a/ctdb/config/ctdbd_wrapper
+++ b/ctdb/config/ctdbd_wrapper
@@ -62,13 +62,15 @@ ctdbd_is_running ()
echo "$_pid"
# Return value of kill is used
- kill -0 $_pid 2>/dev/null
+ kill -0 "$_pid" 2>/dev/null
else
# Missing/empty PID file
return 1
fi
else
if _pid=$(pgrep -f "${ctdbd}\>") ; then
+ # Use word splitting to squash whitespace
+ # shellcheck disable=SC2086
echo $_pid | sed -e 's@ @,@g'
return 0
else
@@ -211,7 +213,7 @@ start()
fi
if [ -n "$CTDB_MAX_OPEN_FILES" ]; then
- ulimit -n $CTDB_MAX_OPEN_FILES
+ ulimit -n "$CTDB_MAX_OPEN_FILES"
fi
_d=$(dirname "$pidfile")
@@ -244,7 +246,7 @@ start()
_pid=""
_timeout="${CTDB_STARTUP_TIMEOUT:-10}"
_count=0
- while [ $_count -lt $_timeout ] ; do
+ while [ "$_count" -lt "$_timeout" ] ; do
# If we don't have the PID then try to read it.
[ -n "$_pid" ] || read _pid 2>/dev/null <"$pidfile"
@@ -286,7 +288,7 @@ stop()
_timeout=${CTDB_SHUTDOWN_TIMEOUT:-30}
_count=0
_terminated=false
- while [ $_count -lt $_timeout ] ; do
+ while [ "$_count" -lt "$_timeout" ] ; do
if ! pkill -0 -s "$_session" 2>/dev/null ; then
_terminated=true
break