diff options
author | LOLi <[email protected]> | 2016-10-07 19:05:06 +0200 |
---|---|---|
committer | Brian Behlendorf <[email protected]> | 2017-02-03 10:24:30 -0800 |
commit | d2beed9116a9b9425b34c03f8e301ad2bb053a42 (patch) | |
tree | 42beacbf25314f70ab7dd532f99308caa7919bd5 | |
parent | 4c83fa9b8762260d766e579cca3da4475fa950ac (diff) |
Fix uninitialized variable snapprops_nvlist in zfs_receive_one
The variable snapprops_nvlist was never initialized, so properties
were not applied to the received snapshot.
Additionally, add zfs_receive_013_pos.ksh script to ZFS test suite to exercise
'zfs receive' functionality for user properties.
Reviewed-by: Brian Behlendorf <[email protected]>
Signed-off-by: loli10K <[email protected]>
Closes #4338
-rw-r--r-- | lib/libzfs/libzfs_sendrecv.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/lib/libzfs/libzfs_sendrecv.c b/lib/libzfs/libzfs_sendrecv.c index bd2fd2947..735d08c9d 100644 --- a/lib/libzfs/libzfs_sendrecv.c +++ b/lib/libzfs/libzfs_sendrecv.c @@ -2689,7 +2689,8 @@ zfs_receive_one(libzfs_handle_t *hdl, int infd, const char *tosnap, ENOENT); if (stream_avl != NULL) { - char *snapname; + char *snapname = NULL; + nvlist_t *lookup = NULL; nvlist_t *fs = fsavl_find(stream_avl, drrb->drr_toguid, &snapname); nvlist_t *props; @@ -2710,6 +2711,11 @@ zfs_receive_one(libzfs_handle_t *hdl, int infd, const char *tosnap, nvlist_free(props); if (ret != 0) return (-1); + + if (0 == nvlist_lookup_nvlist(fs, "snapprops", &lookup)) { + VERIFY(0 == nvlist_lookup_nvlist(lookup, + snapname, &snapprops_nvlist)); + } } cp = NULL; |