]> git.ipfire.org Git - thirdparty/qemu.git/blobdiff - qemu-io-cmds.c
configure: Check if we can use ibv_reg_mr_iova
[thirdparty/qemu.git] / qemu-io-cmds.c
index d46fa166d308ad18e2c2c41d649d682ec80954d1..1b7e700020a28b48f3f9fae2be66f506a9473952 100644 (file)
@@ -401,6 +401,7 @@ static void *qemu_io_alloc_from_file(BlockBackend *blk, size_t len,
     }
 
     fclose(f);
+    f = NULL;
 
     if (len > pattern_len) {
         len -= pattern_len;
@@ -420,6 +421,9 @@ static void *qemu_io_alloc_from_file(BlockBackend *blk, size_t len,
 
 error:
     qemu_io_free(buf_origin);
+    if (f) {
+        fclose(f);
+    }
     return NULL;
 }
 
@@ -1706,7 +1710,12 @@ static int truncate_f(BlockBackend *blk, int argc, char **argv)
         return offset;
     }
 
-    ret = blk_truncate(blk, offset, PREALLOC_MODE_OFF, &local_err);
+    /*
+     * qemu-io is a debugging tool, so let us be strict here and pass
+     * exact=true.  It is better to err on the "emit more errors" side
+     * than to be overly permissive.
+     */
+    ret = blk_truncate(blk, offset, true, PREALLOC_MODE_OFF, &local_err);
     if (ret < 0) {
         error_report_err(local_err);
         return ret;