aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvi Kivity <avi@redhat.com>2009-12-07 11:04:32 +0200
committerAvi Kivity <avi@redhat.com>2009-12-07 11:04:32 +0200
commit149d76049af52aa76f4665b6bc9bdbd5904a8588 (patch)
treee07c6dfe28f03438dff9bb07240a7534c010f990 /qemu-img.c
parentMerge commit 'e9b2e81889d9877415710484b876ee57a42b0bcb' into upstream-merge (diff)
parentDon't leak file descriptors (diff)
downloadqemu-kvm-149d76049af52aa76f4665b6bc9bdbd5904a8588.tar.gz
qemu-kvm-149d76049af52aa76f4665b6bc9bdbd5904a8588.tar.bz2
qemu-kvm-149d76049af52aa76f4665b6bc9bdbd5904a8588.zip
Merge commit '40ff6d7e8dceca227e7f8a3e8e0d58b2c66d19b4' into upstream-merge
* commit '40ff6d7e8dceca227e7f8a3e8e0d58b2c66d19b4': Don't leak file descriptors qemu-img: There is more than one host device driver qcow2: Fix some more qemu_malloc fallout qcow2: Store exact backing format length virtio-blk: Implement rerror option ide: Implement rerror option Conflicts: posix-aio-compat.c Extended qemu_set_cloexec() to compatfd.c. Signed-off-by: Avi Kivity <avi@redhat.com>
Diffstat (limited to 'qemu-img.c')
-rw-r--r--qemu-img.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/qemu-img.c b/qemu-img.c
index 972843ab8..f19c6440e 100644
--- a/qemu-img.c
+++ b/qemu-img.c
@@ -743,7 +743,7 @@ static int img_convert(int argc, char **argv)
if (n > bs_offset + bs_sectors - sector_num)
n = bs_offset + bs_sectors - sector_num;
- if (strcmp(drv->format_name, "host_device")) {
+ if (!drv->no_zero_init) {
/* If the output image is being created as a copy on write image,
assume that sectors which are unallocated in the input image
are present in both the output's and input's base images (no
@@ -776,7 +776,7 @@ static int img_convert(int argc, char **argv)
If the output is to a host device, we also write out
sectors that are entirely 0, since whatever data was
already there is garbage, not 0s. */
- if (strcmp(drv->format_name, "host_device") == 0 || out_baseimg ||
+ if (drv->no_zero_init || out_baseimg ||
is_allocated_sectors(buf1, n, &n1)) {
if (bdrv_write(out_bs, sector_num, buf1, n1) < 0)
error("error while writing");