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 22:41:25 +0100
commit7855959f7cd0d801685f99b2793ca58b50f802c2 (patch)
tree580374a65433ece29fc8e85a61a68551e267c920 /sparsify
parentf0fb8f32b78ff0c405d2f74f9524deb3d55cce61 (diff)
downloadlibguestfs-7855959f7cd0d801685f99b2793ca58b50f802c2.tar.gz
libguestfs-7855959f7cd0d801685f99b2793ca58b50f802c2.tar.xz
libguestfs-7855959f7cd0d801685f99b2793ca58b50f802c2.zip
resize, sparsify: Add a simple-minded check to stop indisk = outdisk.
(cherry picked from commit 84d450210b3ea01de3fe26b2cf1db2b492d77aec)
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 cd231ee4..e9db23af 100644
--- a/sparsify/sparsify.ml
+++ b/sparsify/sparsify.ml
@@ -116,6 +116,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.
*)