summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard W.M. Jones <rjones@redhat.com>2012-09-04 22:29:09 +0100
committerRichard W.M. Jones <rjones@redhat.com>2012-09-04 22:29:48 +0100
commit9c4097dfd827d3b647a9799f11b3a91daecc4f6a (patch)
tree8b92ff96b3deb8da5a8864ad4e19065ea605f63b
parentbdb5689f58c0db18de28d6a703b3af4f22eded38 (diff)
downloadlibguestfs-9c4097dfd827d3b647a9799f11b3a91daecc4f6a.tar.gz
libguestfs-9c4097dfd827d3b647a9799f11b3a91daecc4f6a.tar.xz
libguestfs-9c4097dfd827d3b647a9799f11b3a91daecc4f6a.zip
sparsify: Fix use of closed handle (thanks Olaf Hering).
This fixes commit faaedeb3432253847107ca2c4530f681c6a1e385. Also contains an update to the test which tests the format auto-detect path.
-rw-r--r--sparsify/sparsify.ml2
-rwxr-xr-xsparsify/test-virt-sparsify.sh2
2 files changed, 2 insertions, 2 deletions
diff --git a/sparsify/sparsify.ml b/sparsify/sparsify.ml
index fa729f36..50cbe178 100644
--- a/sparsify/sparsify.ml
+++ b/sparsify/sparsify.ml
@@ -351,7 +351,7 @@ let output_format =
| Some fmt -> fmt (* user specified input format, use that *)
| None ->
(* Don't know, so we must autodetect. *)
- match g#disk_format indisk with
+ match (new G.guestfs ())#disk_format indisk with
| "unknown" ->
error (f_"cannot detect input disk format; use the --format parameter")
| fmt -> fmt
diff --git a/sparsify/test-virt-sparsify.sh b/sparsify/test-virt-sparsify.sh
index 02e98a5d..f85ac082 100755
--- a/sparsify/test-virt-sparsify.sh
+++ b/sparsify/test-virt-sparsify.sh
@@ -37,7 +37,7 @@ rm /boot/big
umount-all
EOF
-$VG ./virt-sparsify --debug-gc --format raw test1.img --convert qcow2 test2.img
+$VG ./virt-sparsify --debug-gc test1.img --convert qcow2 test2.img
size_before=$(du -s test1.img | awk '{print $1}')
size_after=$(du -s test2.img | awk '{print $1}')