[PATCH] storage: Small file probing fixup

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Fallback to possible storage format after nothing else than magic has
matched, since this is likely theformat user wants even though we
don't know any better.

Also fix a comment which wasn't very clear about what "skip" meant.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=836676

Signed-off-by: Martin Kletzander <mkletzan@xxxxxxxxxx>
---
 src/util/virstoragefile.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/src/util/virstoragefile.c b/src/util/virstoragefile.c
index b985df4..b083530 100644
--- a/src/util/virstoragefile.c
+++ b/src/util/virstoragefile.c
@@ -79,7 +79,8 @@ struct FileTypeInfo {
     enum lv_endian endian; /* Endianness of file format */
     int versionOffset;    /* Byte offset from start of file
                            * where we find version number,
-                           * -1 to skip version test */
+                           * -1 to fail version test,
+                           * -2 to pass version test */
     int versionNumber;    /* Version number to validate */
     int sizeOffset;       /* Byte offset from start of file
                            * where we find capacity info,
@@ -662,6 +663,10 @@ virStorageFileProbeFormatFromBuf(const char *path,
         }
     }

+    if (format == VIR_STORAGE_FILE_RAW &&
+        possibleFormat != VIR_STORAGE_FILE_RAW)
+        format = possibleFormat;
+
 cleanup:
     VIR_DEBUG("format=%d", format);
     return format;
-- 
1.8.2.1

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]