On 3/28/19 11:18 AM, Richard W.M. Jones wrote:
Allows you to safely use nbdkit-offset-filter on top of a plugin
supporting extents.
---
filters/offset/offset.c | 36 ++++++++++++++++++++++++++++++++++++
1 file changed, 36 insertions(+)
+
+ extents2 = nbdkit_extents_new (offs + offset, real_size - offset);
+ if (extents2 == NULL) {
+ *err = errno;
+ return -1;
+ }
Here, we are careful to set *err.
+ if (next_ops->extents (nxdata, count, offs + offset,
+ flags, extents2, err) == -1)
+ goto error;
And here.
+
+ 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)
+ goto error;
But here, *err remains unchanged. Is this a problem? Should
nbdkit_add_extent() guarantee that errno is sane on failure (right now,
it does not)?
Affects several filters.
--
Eric Blake, Principal Software Engineer
Red Hat, Inc. +1-919-301-3226
Virtualization:
qemu.org |
libvirt.org