summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOndřej Lysoněk <olysonek@redhat.com>2018-05-08 20:54:58 +0200
committerGuenter Roeck <linux@roeck-us.net>2018-05-14 08:49:01 -0700
commitfb595f55d1a6d0b333f3ad59e290b7657f28e569 (patch)
treee124dcbaaf93f9a3f8882533fa30fe6853ae71fb
parent40aa494c026c67f089a4a84c600114473e9d7787 (diff)
downloadlm-sensors-git-fb595f55d1a6d0b333f3ad59e290b7657f28e569.tar.gz
fancontrol: Do command substitution in double quotes
Do command substitution in double quotes to prevent word splitting. The issue was reported by Coverity Scan. Signed-off-by: Ondřej Lysoněk <olysonek@redhat.com>
-rwxr-xr-xprog/pwm/fancontrol10
1 files changed, 5 insertions, 5 deletions
diff --git a/prog/pwm/fancontrol b/prog/pwm/fancontrol
index eafb7d2b..000a09be 100755
--- a/prog/pwm/fancontrol
+++ b/prog/pwm/fancontrol
@@ -421,12 +421,12 @@ function pwmdisable()
# check if setting pwmN_enable value was successful. Checking the
# pwmN value makes no sense, as it might already have been altered
# by the chip.
- if [ $(cat $ENABLE) = ${PWM_ENABLE_ORIG_STATE[${1}]} ]
+ if [ "$(cat $ENABLE)" = ${PWM_ENABLE_ORIG_STATE[${1}]} ]
then
return 0
fi
# if pwmN_enable is manual (1), check if restoring the pwmN value worked
- elif [ $(cat ${1}) = ${PWM_ORIG_STATE[${1}]} ]
+ elif [ "$(cat ${1})" = ${PWM_ORIG_STATE[${1}]} ]
then
return 0
fi
@@ -434,7 +434,7 @@ function pwmdisable()
# Try pwmN_enable=0
echo 0 > $ENABLE 2> /dev/null
- if [ $(cat $ENABLE) -eq 0 ]
+ if [ "$(cat $ENABLE)" -eq 0 ]
then
# Success
return 0
@@ -443,14 +443,14 @@ function pwmdisable()
# It didn't work, try pwmN_enable=1 pwmN=255
echo 1 > $ENABLE 2> /dev/null
echo $MAX > $1
- if [ $(cat $ENABLE) -eq 1 -a $(cat $1) -ge 190 ]
+ if [ "$(cat $ENABLE)" -eq 1 -a "$(cat $1)" -ge 190 ]
then
# Success
return 0
fi
# Nothing worked
- echo "$ENABLE stuck to" $(cat $ENABLE) >&2
+ echo "$ENABLE stuck to" "$(cat $ENABLE)" >&2
return 1
}