diff options
-rw-r--r-- | resize/resize.ml | 6 | ||||
-rw-r--r-- | sparsify/sparsify.ml | 6 |
2 files changed, 12 insertions, 0 deletions
diff --git a/resize/resize.ml b/resize/resize.ml index 407d80f3..95bc774a 100644 --- a/resize/resize.ml +++ b/resize/resize.ml @@ -187,6 +187,12 @@ read the man page virt-resize(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 infile = outfile then + error "you cannot use the same disk image for input and output"; + infile, outfile, align_first, alignment, copy_boot_loader, debug, debug_gc, deletes, dryrun, expand, expand_content, extra_partition, format, ignores, 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. *) |