summaryrefslogtreecommitdiffstats
path: root/lib
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 /lib
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 'lib')
-rw-r--r--lib/libzfs/libzfs_sendrecv.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/libzfs/libzfs_sendrecv.c b/lib/libzfs/libzfs_sendrecv.c
index 4a620a9da..710bc1912 100644
--- a/lib/libzfs/libzfs_sendrecv.c
+++ b/lib/libzfs/libzfs_sendrecv.c
@@ -3801,8 +3801,9 @@ zfs_receive_one(libzfs_handle_t *hdl, int infd, const char *tosnap,
}
ASSERT(strstr(drrb->drr_toname, sendfs) == drrb->drr_toname);
- ASSERT(chopprefix > drrb->drr_toname);
- ASSERT(chopprefix <= drrb->drr_toname + strlen(drrb->drr_toname));
+ ASSERT(chopprefix > drrb->drr_toname || strchr(sendfs, '/') == NULL);
+ ASSERT(chopprefix <= drrb->drr_toname + strlen(drrb->drr_toname) ||
+ strchr(sendfs, '/') == NULL);
ASSERT(chopprefix[0] == '/' || chopprefix[0] == '@' ||
chopprefix[0] == '\0');