summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorLOLi <[email protected]>2018-01-31 00:54:33 +0100
committerBrian Behlendorf <[email protected]>2018-01-30 15:54:33 -0800
commitbee7e4ff12c7170671606bcea33a6eef6cad5d58 (patch)
treedc4764edc34ecbc7108046c7980a47b0794e42e6 /lib
parent405ec516abbae42f205328ffc1bd7b38cbdd45da (diff)
Fix 'zfs receive -o' when used with '-e|-d'
When used in conjunction with one of '-e' or '-d' zfs receive options none of the properties requested to be set (-o) are actually applied: this is caused by a wrong assumption made about the toplevel dataset in zfs_receive_one(). Fix this by correctly detecting the toplevel dataset. Reviewed-by: Tony Hutter <[email protected]> Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: loli10K <[email protected]> Closes #7088
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 934da54e1..e12a9db43 100644
--- a/lib/libzfs/libzfs_sendrecv.c
+++ b/lib/libzfs/libzfs_sendrecv.c
@@ -3603,7 +3603,7 @@ zfs_receive_one(libzfs_handle_t *hdl, int infd, const char *tosnap,
nvlist_t *oxprops = NULL; /* override (-o) and exclude (-x) props */
nvlist_t *origprops = NULL; /* original props (if destination exists) */
zfs_type_t type;
- boolean_t toplevel;
+ boolean_t toplevel = B_FALSE;
boolean_t zoned = B_FALSE;
begin_time = time(NULL);
@@ -4013,7 +4013,8 @@ zfs_receive_one(libzfs_handle_t *hdl, int infd, const char *tosnap,
goto out;
}
- toplevel = chopprefix[0] != '/';
+ if (top_zfs && *top_zfs == NULL)
+ toplevel = B_TRUE;
if (drrb->drr_type == DMU_OST_ZVOL) {
type = ZFS_TYPE_VOLUME;
} else if (drrb->drr_type == DMU_OST_ZFS) {