Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

fault-injection: fix failcmd.sh warning

"fault-injection: add tool to run command with failslab or
fail_page_alloc" added tools/testing/fault-injection/failcmd.sh to make it
easier to inject slab/page allocation failures by fault injection.

failcmd.sh prints the following warning when running with arguments
for command.

# ./failcmd.sh echo aaa
failcmd.sh: line 209: [: echo: binary operator expected
aaa

This warning is caused by an improper check whether at least one
parameter is left after parsing command options.

Fix it by testing the length of $1 instead of $@

Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

authored by

Akinobu Mita and committed by
Linus Torvalds
d6b09e75 2e3ee613

+1 -1
+1 -1
tools/testing/fault-injection/failcmd.sh
··· 206 206 esac 207 207 done 208 208 209 - [ -z "$@" ] && exit 0 209 + [ -z "$1" ] && exit 0 210 210 211 211 echo $oom_kill_allocating_task > /proc/sys/vm/oom_kill_allocating_task 212 212 echo $task_filter > $FAULTATTR/task-filter