diff options
author | Ryan Moeller <[email protected]> | 2021-08-05 15:32:57 +0000 |
---|---|---|
committer | Brian Behlendorf <[email protected]> | 2022-02-01 17:02:58 -0800 |
commit | 24f1aa023ad3cb2f328883e78f517de6dc40091d (patch) | |
tree | 33aada4128e1d0e49ef31f981a64929633b6efdf /lib/libzfs | |
parent | 25074b472ac232c82138b1f7642446c816cb2a51 (diff) |
libzfs_sendrecv: Initialize in case of failure
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 <[email protected]>
Signed-off-by: Ryan Moeller <[email protected]>
Closes #12967
Diffstat (limited to 'lib/libzfs')
-rw-r--r-- | lib/libzfs/libzfs_sendrecv.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/libzfs/libzfs_sendrecv.c b/lib/libzfs/libzfs_sendrecv.c index fea49e3ab..d1538d146 100644 --- a/lib/libzfs/libzfs_sendrecv.c +++ b/lib/libzfs/libzfs_sendrecv.c @@ -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) |