[Libguestfs] [PATCH nbdkit 2/2] filters: Be careful to set *err if nbdkit_add_extent or nbdkit_extents_new fail.

Eric Blake eblake at redhat.com
Wed Apr 24 12:30:49 UTC 2019


On 4/24/19 6:04 AM, Richard W.M. Jones wrote:
> Thanks: Eric Blake for reporting the bug.
> ---
>  filters/offset/offset.c       | 4 +++-
>  filters/partition/partition.c | 4 +++-
>  filters/truncate/truncate.c   | 8 +++++++-
>  3 files changed, 13 insertions(+), 3 deletions(-)
> 
> diff --git a/filters/offset/offset.c b/filters/offset/offset.c
> index 24ccb4c..633a1c7 100644
> --- a/filters/offset/offset.c
> +++ b/filters/offset/offset.c
> @@ -156,8 +156,10 @@ offset_extents (struct nbdkit_next_ops *next_ops, void *nxdata,
>    for (i = 0; i < nbdkit_extents_count (extents2); ++i) {
>      e = nbdkit_get_extent (extents2, i);
>      e.offset -= offset;
> -    if (nbdkit_add_extent (extents, e.offset, e.length, e.type) == -1)
> +    if (nbdkit_add_extent (extents, e.offset, e.length, e.type) == -1) {
> +      *err = errno;
>        return -1;
> +    }
>    }

I'll see if I can spot other places that also need the cleanup, but this
patch is incrementally better than what we have, so 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/a8c35ac6/attachment.sig>


More information about the Libguestfs mailing list