git » libfiu » commit 82621d9

util/fiu-ctrl: Fix deprecated options

author Alberto Bertogli
2012-10-17 22:47:31 UTC
committer Alberto Bertogli
2012-10-17 22:47:31 UTC
parent 17fdac566ea722984d7fcb3e1e3aad946900568e

util/fiu-ctrl: Fix deprecated options

The deprecated options were broken, and the resulting commands were not being
sent over the control pipe.

This patch should fix them, so that the options work once again.

Thanks to Serafeim Zanikolas for reporting this issue.

Signed-off-by: Alberto Bertogli <albertito@blitiri.com.ar>

utils/fiu-ctrl +6 -5

diff --git a/utils/fiu-ctrl b/utils/fiu-ctrl
index 709a70e..1b400d8 100755
--- a/utils/fiu-ctrl
+++ b/utils/fiu-ctrl
@@ -80,13 +80,13 @@ function opts_reset() {
 }
 
 function add_deprecated_enable() {
-	if [ "$NAME" == "" ]; then
+	if [ "$DEP_NAME" == "" ]; then
 		return
 	fi;
 
 	PARAMS="name=$DEP_NAME,failnum=$DEP_FAILNUM,failinfo=$DEP_FAILINFO"
-	if [ $PROB -ge 0 ]; then
-		C="enable_random $PARAMS,probability=$PROB"
+	if [ "$DEP_PROB" -ge 0 ]; then
+		C="enable_random $PARAMS,probability=0.$DEP_PROB"
 	else
 		C="enable $PARAMS"
 	fi
@@ -139,8 +139,8 @@ while getopts "+c:e:p:u:i:d:f:h" opt; do
 done
 
 # add leftovers
-if [ "$NAME" != "" ]; then
-	add_cmd;
+if [ "$DEP_NAME" != "" ]; then
+	add_deprecated_enable;
 fi
 
 # eat the parameters we already processed
@@ -176,6 +176,7 @@ function send_cmd_fifo() {
 	if [ "$REPLY" == "-1" ]; then
 		echo "$P: Command '$@' returned error ($REPLY)"
 	fi
+	#echo "$P: $@ -> $REPLY"
 }
 
 for c in "${CMDS[@]}"; do