[Libguestfs] [PATCH nbdkit 1/2] server: extents: Set errno on error from nbdkit_add_extent.

Eric Blake eblake at redhat.com
Wed Apr 24 12:29:58 UTC 2019


On 4/24/19 6:04 AM, Richard W.M. Jones wrote:
> errno is currently set to a suitable value if nbdkit_extents_new
> returns an error, but this was not documented so I added that
> documentation.
> 
> Set errno to a suitable value if nbdkit_add_extent returns an error,
> and also document that.
> 
> Thanks: Eric Blake for spotting the problem.
> ---
>  docs/nbdkit-filter.pod | 3 ++-
>  docs/nbdkit-plugin.pod | 2 +-
>  server/extents.c       | 2 ++
>  3 files changed, 5 insertions(+), 2 deletions(-)

> +++ b/server/extents.c
> @@ -154,6 +154,7 @@ nbdkit_add_extent (struct nbdkit_extents *exts,
>      nbdkit_error ("nbdkit_add_extent: "
>                    "extents must be added in ascending order and "
>                    "must be contiguous");
> +    errno = ERANGE;
>      return -1;

ERANGE can't be sent over the wire to the client (we end up sending
NBD_EINVAL instead), but it is the best choice for server-side logging
when diagnosing the problem.  ACK.

-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3226
Virtualization:  qemu.org | libvirt.org

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libguestfs/attachments/20190424/ee1abec8/attachment.sig>


More information about the Libguestfs mailing list