Skip to contentSkip to conversation

Fix return code of xentop

PATCH New Masaki Kanno 1 participant 1 message Jan 28, 2007

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Fix return code of xentop

Hi,

When I tested the xentop with a wrong option, the xentop returned the return code 0.

# xentop --abc
xentop: unrecognized option `--abc'
Usage: xentop [OPTION]
Displays ongoing information about xen vm resources 
<snip>
# echo $?
0

If the wrong option was specified, I think that the xentop had better return the return code 1 (or not 0). This patch fixes the return code of the xentop when the wrong option was specified.

Best regards,
Kan

tools/xenstat/xentop/xentop.c +3 -1
diff -r d1710eb35385 tools/xenstat/xentop/xentop.c
@@ -998,9 +998,11 @@ int main(int argc, char **argv)
 
 	while ((opt = getopt_long(argc, argv, sopts, lopts, &optind)) != -1) {
 		switch (opt) {
-		case 'h':
 		case '?':
 		default:
+			usage(argv[0]);
+			exit(1);
+		case 'h':
 			usage(argv[0]);
 			exit(0);
 		case 'V':

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel