summaryrefslogtreecommitdiffstats
path: root/sys-utils/zramctl.c
diff options
context:
space:
mode:
authorSami Kerola2014-08-06 11:35:30 +0200
committerKarel Zak2014-08-11 14:47:08 +0200
commit1fa6c3e0b963ef5da43607fcec682541b40dcab1 (patch)
treebc7794c5423ad13c9922fcd8d92b8d659c028302 /sys-utils/zramctl.c
parentzramctl: add bash completion script (diff)
downloadkernel-qcow2-util-linux-1fa6c3e0b963ef5da43607fcec682541b40dcab1.tar.gz
kernel-qcow2-util-linux-1fa6c3e0b963ef5da43607fcec682541b40dcab1.tar.xz
kernel-qcow2-util-linux-1fa6c3e0b963ef5da43607fcec682541b40dcab1.zip
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 <kerolasa@iki.fi> Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'sys-utils/zramctl.c')
-rw-r--r--sys-utils/zramctl.c7
1 files changed, 4 insertions, 3 deletions
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 <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;