From 1fa6c3e0b963ef5da43607fcec682541b40dcab1 Mon Sep 17 00:00:00 2001 From: Sami Kerola Date: Wed, 6 Aug 2014 10:35:30 +0100 Subject: zramctl: improve option combination error messaging 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 Signed-off-by: Karel Zak --- sys-utils/zramctl.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'sys-utils/zramctl.c') diff --git a/sys-utils/zramctl.c b/sys-utils/zramctl.c index 63c2c131a..961dba1d0 100644 --- a/sys-utils/zramctl.c +++ b/sys-utils/zramctl.c @@ -505,11 +505,12 @@ int main(int argc, char **argv) if (act != A_RESET && optind + 1 < argc) errx(EXIT_FAILURE, _("only one 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; -- cgit v1.2.3-55-g7522