aboutsummaryrefslogtreecommitdiffstats
path: root/cmd/zfs/zfs_main.c
diff options
context:
space:
mode:
authorLOLi <[email protected]>2018-12-04 18:38:55 +0100
committerBrian Behlendorf <[email protected]>2018-12-04 09:38:55 -0800
commitbdbd5477bcba03b1df1e02b3b89e795c99e2f4c8 (patch)
treea29cacf3008ea0ad2109b2bb6057632394fd92e1 /cmd/zfs/zfs_main.c
parent7c9a42921e60dbad0e3003bd571591f073860233 (diff)
Fix ASSERT in zfs_receive_one()
This commit fixes the following ASSERT in zfs_receive_one() when receiving a send stream from a root dataset with the "-e" option: $ sudo zfs snap source@snap $ sudo zfs send source@snap | sudo zfs recv -e destination/recv chopprefix > drrb->drr_toname ASSERT at libzfs_sendrecv.c:3804:zfs_receive_one() Reviewed-by: Tom Caputi <[email protected]> Reviewed-by: Brian Behlendorf <[email protected]> Reviewed by: Paul Dagnelie <[email protected]> Signed-off-by: loli10K <[email protected]> Closes #8121
Diffstat (limited to 'cmd/zfs/zfs_main.c')
-rw-r--r--cmd/zfs/zfs_main.c17
1 files changed, 16 insertions, 1 deletions
diff --git a/cmd/zfs/zfs_main.c b/cmd/zfs/zfs_main.c
index 2b7fe9303..6b08bb115 100644
--- a/cmd/zfs/zfs_main.c
+++ b/cmd/zfs/zfs_main.c
@@ -4240,10 +4240,21 @@ zfs_do_receive(int argc, char **argv)
}
break;
case 'd':
+ if (flags.istail) {
+ (void) fprintf(stderr, gettext("invalid option "
+ "combination: -d and -e are mutually "
+ "exclusive\n"));
+ usage(B_FALSE);
+ }
flags.isprefix = B_TRUE;
break;
case 'e':
- flags.isprefix = B_TRUE;
+ if (flags.isprefix) {
+ (void) fprintf(stderr, gettext("invalid option "
+ "combination: -d and -e are mutually "
+ "exclusive\n"));
+ usage(B_FALSE);
+ }
flags.istail = B_TRUE;
break;
case 'n':
@@ -4279,6 +4290,10 @@ zfs_do_receive(int argc, char **argv)
argc -= optind;
argv += optind;
+ /* zfs recv -e (use "tail" name) implies -d (remove dataset "head") */
+ if (flags.istail)
+ flags.isprefix = B_TRUE;
+
/* check number of arguments */
if (argc < 1) {
(void) fprintf(stderr, gettext("missing snapshot argument\n"));