cmd/zfs: redact: better error message for common usage errors

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Matt Ahrens <matt@delphix.com>
Signed-off-by: Christian Schwarz <me@cschwarz.com>
Closes #9867
This commit is contained in:
Christian Schwarz
2019-11-25 20:08:20 +01:00
committed by Brian Behlendorf
parent 7b53e2e5a9
commit f658f61c72
2 changed files with 19 additions and 2 deletions
+11 -2
View File
@@ -3746,8 +3746,13 @@ zfs_do_redact(int argc, char **argv)
"specified\n"));
break;
case EINVAL:
(void) fprintf(stderr, gettext("redaction snapshot must be "
"descendent of snapshot being redacted\n"));
if (strchr(bookname, '#') != NULL)
(void) fprintf(stderr, gettext(
"redaction bookmark name must not contain '#'\n"));
else
(void) fprintf(stderr, gettext(
"redaction snapshot must be descendent of "
"snapshot being redacted\n"));
break;
case EALREADY:
(void) fprintf(stderr, gettext("attempted to redact redacted "
@@ -3757,6 +3762,10 @@ zfs_do_redact(int argc, char **argv)
(void) fprintf(stderr, gettext("redaction bookmarks feature "
"not enabled\n"));
break;
case EXDEV:
(void) fprintf(stderr, gettext("potentially invalid redaction "
"snapshot; full dataset names required\n"));
break;
default:
(void) fprintf(stderr, gettext("internal error: %s\n"),
strerror(errno));