On Wed, May 18, 2016 at 05:33:32PM +0200, Pino Toscano wrote:
When creating the dummy scratch disk for a /dev/null drive, force
its
format as raw if it was not specified already. After all, raw was
already the only format allowed for this kind of drives, so it makes
sense to specify the format explicitly and avoid the autodetection in
qemu.
---
src/drives.c | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)
diff --git a/src/drives.c b/src/drives.c
index c55b87e..5e7eb12 100644
--- a/src/drives.c
+++ b/src/drives.c
@@ -410,9 +410,15 @@ create_drive_dev_null (guestfs_h *g,
{
CLEANUP_FREE char *tmpfile = NULL;
- if (data->format && STRNEQ (data->format, "raw")) {
- error (g, _("for device '/dev/null', format must be
'raw'"));
- return NULL;
+ if (data->format) {
+ if (STRNEQ (data->format, "raw")) {
+ error (g, _("for device '/dev/null', format must be
'raw'"));
+ return NULL;
+ }
+ } else {
+ /* Manual set format=raw for /dev/null drives, if that was not
+ * already manually specified. */
+ data->format = "raw";
}
if (guestfs_int_lazy_make_tmpdir (g) == -1)
Difference is it avoids a useless test in previous patch, ACK.
Rich.
--
Richard Jones, Virtualization Group, Red Hat
http://people.redhat.com/~rjones
Read my programming and virtualization blog:
http://rwmj.wordpress.com
Fedora Windows cross-compiler. Compile Windows programs, test, and
build Windows installers. Over 100 libraries supported.
http://fedoraproject.org/wiki/MinGW