[Pkg-libvirt-commits] [libguestfs] 99/233: sparsify: Prevent overwriting block or char output devices (RHBZ#1056290).
Hilko Bengen
bengen at moszumanska.debian.org
Wed Feb 19 21:11:22 UTC 2014
This is an automated email from the git hooks/post-receive script.
bengen pushed a commit to branch experimental
in repository libguestfs.
commit 13bca32e4ec9213e69ea55e837dea846719fb67e
Author: Richard W.M. Jones <rjones at redhat.com>
Date: Wed Jan 22 13:10:08 2014 +0000
sparsify: Prevent overwriting block or char output devices (RHBZ#1056290).
virt-sparsify doesn't work if the output is a block device, and cannot
possibly work if the output is a char device. Currently if you try
this it actually overwrites (deletes) the output device which is not
exactly desirable. Therefore throw an error and exit.
---
sparsify/sparsify.ml | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/sparsify/sparsify.ml b/sparsify/sparsify.ml
index 25bd0ec..3e544db 100644
--- a/sparsify/sparsify.ml
+++ b/sparsify/sparsify.ml
@@ -167,6 +167,15 @@ read the man page virt-sparsify(1).
if contains_colon outdisk then
error (f_"output filename '%s' contains a colon (':'); qemu-img command line syntax prevents us from using such an image") outdisk;
+ (* Check the output is not a block or char special (RHBZ#1056290). *)
+ if is_block_device outdisk then
+ error (f_"output '%s' cannot be a block device, it must be a regular file")
+ outdisk;
+
+ if is_char_device outdisk then
+ error (f_"output '%s' cannot be a character device, it must be a regular file")
+ outdisk;
+
indisk, outdisk, check_tmpdir, compress, convert,
debug_gc, format, ignores, machine_readable,
option, quiet, verbose, trace, zeroes
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-libvirt/libguestfs.git
More information about the Pkg-libvirt-commits
mailing list