summaryrefslogtreecommitdiffstats
path: root/sparsify
diff options
context:
space:
mode:
authorRichard W.M. Jones <rjones@redhat.com>2012-04-17 15:03:02 +0100
committerRichard W.M. Jones <rjones@redhat.com>2012-04-17 15:03:02 +0100
commit84d450210b3ea01de3fe26b2cf1db2b492d77aec (patch)
treeaaeb0721f9e4eb2535c80ed1a087c9fa26c46bfe /sparsify
parent8d3d5a52d2746af91f770608cce5f47462f33aba (diff)
downloadlibguestfs-84d450210b3ea01de3fe26b2cf1db2b492d77aec.tar.gz
libguestfs-84d450210b3ea01de3fe26b2cf1db2b492d77aec.tar.xz
libguestfs-84d450210b3ea01de3fe26b2cf1db2b492d77aec.zip
resize, sparsify: Add a simple-minded check to stop indisk = outdisk.
Diffstat (limited to 'sparsify')
-rw-r--r--sparsify/sparsify.ml6
1 files changed, 6 insertions, 0 deletions
diff --git a/sparsify/sparsify.ml b/sparsify/sparsify.ml
index 8d23b405..a1382e63 100644
--- a/sparsify/sparsify.ml
+++ b/sparsify/sparsify.ml
@@ -121,6 +121,12 @@ read the man page virt-sparsify(1).
| _ ->
error "usage is: %s [--options] indisk outdisk" prog in
+ (* Simple-minded check that the user isn't trying to use the
+ * same disk for input and output.
+ *)
+ if indisk = outdisk then
+ error "you cannot use the same disk image for input and output";
+
(* The input disk must be an absolute path, so we can store the name
* in the overlay disk.
*)