From 87ee63cbac781182eae612c8f02a305de188d6eb Mon Sep 17 00:00:00 2001
From: Morris Jette <jette@schedmd.com>
Date: Tue, 17 Sep 2013 16:17:04 -0700
Subject: [PATCH] scontrol parsing problem

Bug introduced earlier today in commit 7912c05bb410567899b857367450d7dbb7905e71
---
 src/scontrol/scontrol.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/src/scontrol/scontrol.c b/src/scontrol/scontrol.c
index 93a04223404..e5379e2d460 100644
--- a/src/scontrol/scontrol.c
+++ b/src/scontrol/scontrol.c
@@ -130,11 +130,10 @@ main (int argc, char *argv[])
 	while (1) {
 		if (!strncasecmp(argv[optind], "setdebugflags", 8))
 			break;	/* avoid parsing "-<flagname>" as option */
-		opt_char = getopt_long(argc, argv, "adhM:oQvV",
-				       long_options, &option_index);
-		switch (opt_char) {
-		case -1:
+		if (opt_char = getopt_long(argc, argv, "adhM:oQvV",
+					   long_options, &option_index) == -1)
 			break;
+		switch (opt_char) {
 		case (int)'?':
 			fprintf(stderr, "Try \"scontrol --help\" for "
 				"more information\n");
-- 
GitLab