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