Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/usr.sbin/mmcformat - don't make -h/-H get around the argumen...



details:   https://anonhg.NetBSD.org/src/rev/c413e0484714
branches:  trunk
changeset: 838928:c413e0484714
user:      mrg <mrg%NetBSD.org@localhost>
date:      Mon Feb 04 09:53:41 2019 +0000

description:
- don't make -h/-H get around the argument check by setting
  'inquiry' in the fallthru case, but instead explicitly
  check for 'display_usage' as well.

diffstat:

 usr.sbin/mmcformat/mmcformat.c |  11 ++++++-----
 1 files changed, 6 insertions(+), 5 deletions(-)

diffs (32 lines):

diff -r 4d6f93dc2863 -r c413e0484714 usr.sbin/mmcformat/mmcformat.c
--- a/usr.sbin/mmcformat/mmcformat.c    Mon Feb 04 09:51:47 2019 +0000
+++ b/usr.sbin/mmcformat/mmcformat.c    Mon Feb 04 09:53:41 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: mmcformat.c,v 1.4 2013/10/19 17:16:37 christos Exp $ */
+/* $NetBSD: mmcformat.c,v 1.5 2019/02/04 09:53:41 mrg Exp $ */
 
 /*
  * Copyright (c) 2006, 2008 Reinoud Zandijk
@@ -765,6 +765,7 @@
                        case 'h' :
                        case 'H' :
                                display_usage = 1;
+                               break;
                        case 'I' :
                                inquiry = 1;
                                break;
@@ -792,10 +793,10 @@
        argv += optind;
        argc -= optind;
 
-       if ((!blank && !format && !grow_session && !grow_spare) &&
-           (!expert && !inquiry)) {
-               fprintf(stderr, "%s : at least one of -B, -F, -G, -S, -X or -I "
-                               "needs to be specified\n\n", progname);
+       if (!blank && !format && !grow_session && !grow_spare &&
+           !expert && !inquiry && !display_usage) {
+               fprintf(stderr, "%s : at least one of -B, -F, -G, -h, -H -S, "
+                               "-X or -I needs to be specified\n\n", progname);
                return usage(progname);
        }
 



Home | Main Index | Thread Index | Old Index