Skip to content

Commit

Permalink
fault-injection: fix failcmd.sh warning
Browse files Browse the repository at this point in the history
"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 <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
mita authored and torvalds committed Aug 1, 2012
1 parent 2e3ee61 commit d6b09e7
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion tools/testing/fault-injection/failcmd.sh
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ while true; do
esac
done

[ -z "$@" ] && exit 0
[ -z "$1" ] && exit 0

echo $oom_kill_allocating_task > /proc/sys/vm/oom_kill_allocating_task
echo $task_filter > $FAULTATTR/task-filter
Expand Down

0 comments on commit d6b09e7

Please sign in to comment.