Skip to content

Commit

Permalink
libzfs_sendrecv: Initialize in case of failure
Browse files Browse the repository at this point in the history
In zfs_send_progress, initialize \*bytes_written and \*blocks_visited
in case we have to return early due to ioctl failure.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Ryan Moeller <freqlabs@FreeBSD.org>
Closes openzfs#12967
  • Loading branch information
Ryan Moeller authored and nicman23 committed Aug 22, 2022
1 parent 0331d2f commit 724a112
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lib/libzfs/libzfs_sendrecv.c
Original file line number Diff line number Diff line change
Expand Up @@ -883,6 +883,10 @@ zfs_send_progress(zfs_handle_t *zhp, int fd, uint64_t *bytes_written,
{
zfs_cmd_t zc = {"\0"};

if (bytes_written != NULL)
*bytes_written = 0;
if (blocks_visited != NULL)
*blocks_visited = 0;
(void) strlcpy(zc.zc_name, zhp->zfs_name, sizeof (zc.zc_name));
zc.zc_cookie = fd;
if (zfs_ioctl(zhp->zfs_hdl, ZFS_IOC_SEND_PROGRESS, &zc) != 0)
Expand Down

0 comments on commit 724a112

Please sign in to comment.