]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
zramctl: improve option combination error messaging
authorSami Kerola <kerolasa@iki.fi>
Wed, 6 Aug 2014 09:35:30 +0000 (10:35 +0100)
committerKarel Zak <kzak@redhat.com>
Mon, 11 Aug 2014 12:47:08 +0000 (14:47 +0200)
Use of --algorithm or --streams is not expected to work without
reseting device, that happens when --size is specified, so ensure the
former options to be combined with the later.

[kzak@redhat.com: - make it more generic]

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Signed-off-by: Karel Zak <kzak@redhat.com>
sys-utils/zramctl.c

index 63c2c131ae63b1628f66781ce860d87b7b2d23e0..961dba1d06083856027b90ea0152553c1a168e1e 100644 (file)
@@ -505,11 +505,12 @@ int main(int argc, char **argv)
        if (act != A_RESET && optind + 1 < argc)
                errx(EXIT_FAILURE, _("only one <device> at a time is allowed"));
 
+       if ((act == A_STATUS || act == A_FINDONLY) && (algorithm || nstreams))
+               errx(EXIT_FAILURE, _("options --algorithm and --streams "
+                                    "must be combined with --size"));
+
        switch (act) {
        case A_STATUS:
-               if (algorithm || find || nstreams)
-                       errx(EXIT_FAILURE, _("options --algorithm, --find and "
-                                       "--streams are mutually exclusive"));
                if (!ncolumns) {                /* default columns */
                        columns[ncolumns++] = COL_NAME;
                        columns[ncolumns++] = COL_ALGORITHM;