diff options
author | Gvozden Neskovic <[email protected]> | 2016-07-09 18:37:11 +0200 |
---|---|---|
committer | Brian Behlendorf <[email protected]> | 2016-07-13 10:20:08 -0700 |
commit | 1bf3bf0e2986ac0b8be18b2e2952f39353cc5daa (patch) | |
tree | 4ddf8ebe0604c130087b887c9ca4639a596ff8f1 /module/zfs/zfs_ioctl.c | |
parent | 81edd3e83409218879e7af293daa86b0c40eb015 (diff) |
Fix handling of errors nvlist in zfs_ioc_recv_new()
zfs_ioc_recv_impl() is changed to always allocate the 'errors'
nvlist, its callers are responsible for freeing it.
Signed-off-by: Gvozden Neskovic <[email protected]>
Signed-off-by: Brian Behlendorf <[email protected]>
Closes #4829
Diffstat (limited to 'module/zfs/zfs_ioctl.c')
-rw-r--r-- | module/zfs/zfs_ioctl.c | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/module/zfs/zfs_ioctl.c b/module/zfs/zfs_ioctl.c index f607225d1..37104fb9f 100644 --- a/module/zfs/zfs_ioctl.c +++ b/module/zfs/zfs_ioctl.c @@ -4054,8 +4054,8 @@ static boolean_t zfs_ioc_recv_inject_err; #endif /* - * On failure the 'errors' nvlist may be allocated and will contain a - * descriptions of the failures. It's the callers responsibilty to free. + * nvlist 'errors' is always allocated. It will contain descriptions of + * encountered errors, if any. It's the callers responsibility to free. */ static int zfs_ioc_recv_impl(char *tofs, char *tosnap, char *origin, @@ -4072,7 +4072,10 @@ zfs_ioc_recv_impl(char *tofs, char *tosnap, char *origin, boolean_t first_recvd_props = B_FALSE; file_t *input_fp; - *errors = NULL; + *read_bytes = 0; + *errflags = 0; + *errors = fnvlist_alloc(); + input_fp = getf(input_fd); if (input_fp == NULL) return (SET_ERROR(EBADF)); @@ -4082,10 +4085,6 @@ zfs_ioc_recv_impl(char *tofs, char *tosnap, char *origin, if (error != 0) goto out; - *read_bytes = 0; - *errflags = 0; - *errors = fnvlist_alloc(); - /* * Set properties before we receive the stream so that they are applied * to the new data. Note that we must call dmu_recv_stream() if |