onnode: Exit with error for unknown command-line flags.
authorMartin Schwenke <martin@meltin.net>
Tue, 17 May 2011 03:25:08 +0000 (13:25 +1000)
committerRonnie Sahlberg <ronniesahlberg@gmail.com>
Wed, 8 Jun 2011 04:22:16 +0000 (14:22 +1000)
Use of "local" was masking errors in command-line processing.

Signed-off-by: Martin Schwenke <martin@meltin.net>
(This used to be ctdb commit ca80adda7517b43147ef30156ae34c66b29fa2bd)

ctdb/tools/onnode

index 7e1b0cac835588dcb8a37d153dae777e984344b7..77a1207d6c23433f300a66f1caad3d42eaeb18d8 100755 (executable)
@@ -70,7 +70,9 @@ parse_options ()
     # $POSIXLY_CORRECT means that the command passed to onnode can
     # take options and getopt won't reorder things to make them
     # options ot onnode.
-    local temp=$(POSIXLY_CORRECT=1 getopt -n "$prog" -o "cf:hno:pqv" -l help -- "$@")
+    local temp
+    # Not on the previous line - local returns 0!
+    temp=$(POSIXLY_CORRECT=1 getopt -n "$prog" -o "cf:hno:pqv" -l help -- "$@")
 
     [ $? != 0 ] && usage