Signed-off-by: Markus Armbruster <arm...@redhat.com>
---
 qemu-img.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/qemu-img.c b/qemu-img.c
index 3ae5fe3..cf3ef3e 100644
--- a/qemu-img.c
+++ b/qemu-img.c
@@ -2838,6 +2838,10 @@ static int img_map(int argc, char **argv)
     }
 
     length = blk_getlength(blk);
+    if (length < 0) {
+        error_report("Couldn't get length of image '%s': %s",
+                     filename, strerror(-length));
+    }
     while (curr.start + curr.length < length) {
         int64_t nsectors_left;
         int64_t sector_num;
-- 
2.7.5


Reply via email to