ShaunR
2010-Oct-22 22:27 UTC
[Xen-devel] [PATCH] tools/xenstat/xentop/xentop.c -- fix xentop so it returns the correct exit code on invalid argument
This patch fixes the problem with xentop where it returns an exit code of 0 when passing it invalid options when it should return 1. The issue comes from getopt() returning ''?'' and the case from switch matching it. The solution was to remove the case ''?'' so that the default match could be triggered. Quote from `man 3 getopt` "If getopt() does not recognize an option character, it prints an error message to stderr, stores the character in optopt, and returns ''?''." --- tools/xenstat/xentop/xentop.c-orig 2010-10-22 15:20:13.000000000 -0700 +++ tools/xenstat/xentop/xentop.c 2010-10-22 15:20:21.000000000 -0700 @@ -1135,7 +1135,6 @@ default: usage(argv[0]); exit(1); - case ''?'': case ''h'': usage(argv[0]); exit(0); _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Apparently Analagous Threads
- [PATCH] Fix for Solaris compile/output for VBDs in xentop
- [PATCH] SIGTERM and SIGINT handler to flush xentop -b outputs
- Bug#409355: xen-utils-common: please make width of hostname column in xentop wider
- [PATCH][XENTOP][4/4] Display blktap statistics.
- Regarding xenstat [test.c:3:24: fatal error: xenstat.h: No such file or directory]