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..1a4ae27 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 (data->format && 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)
--
2.5.5