If no operations were specified then ensure we emit the usage.

Signed-off-by: Andy Whitcroft <[EMAIL PROTECTED]>
---
 hugeadm.c |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/hugeadm.c b/hugeadm.c
index 8434eef..9c7ae1c 100644
--- a/hugeadm.c
+++ b/hugeadm.c
@@ -244,6 +244,8 @@ void page_sizes(int all)
 
 int main(int argc, char** argv)
 {
+       int ops;
+
        char opts[] = "+h";
        int ret = 0, index = 0;
        struct option long_opts[] = {
@@ -262,6 +264,7 @@ int main(int argc, char** argv)
        hugetlbfs_setup_debug();
        setup_mounts();
 
+       ops = 0;
        while (ret != -1) {
                ret = getopt_long(argc, argv, opts, long_opts, &index);
                switch (ret) {
@@ -301,10 +304,12 @@ int main(int argc, char** argv)
                        ret = -1;
                        break;
                }
+               if (ret != -1)
+                       ops++;
        }
        index = optind;
 
-       if ((argc - index) != 0) {
+       if ((argc - index) != 0 || ops == 0) {
                print_usage();
                exit(EXIT_FAILURE);
        }
-- 
1.6.0.2.711.gf1ba4


-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Libhugetlbfs-devel mailing list
Libhugetlbfs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libhugetlbfs-devel

Reply via email to