Don't mix fnvlist_size and nvlist_pack

fnvlist_size implies an encoding format while nvlist_pack takes an
explict one.
This commit is contained in:
Brooks Davis 2022-11-18 00:54:36 +00:00
parent 6cbd8f4289
commit db0d791f83
1 changed files with 2 additions and 1 deletions

View File

@ -1203,8 +1203,9 @@ zcmd_write_nvlist_com(libzfs_handle_t *hdl, uint64_t *outnv, uint64_t *outlen,
nvlist_t *nvl)
{
char *packed;
size_t len;
size_t len = fnvlist_size(nvl);
verify(nvlist_size(nvl, &len, NV_ENCODE_XDR) == 0);
packed = zfs_alloc(hdl, len);
verify(nvlist_pack(nvl, &packed, &len, NV_ENCODE_XDR, 0) == 0);