On Wed, Jan 08, 2020 at 06:39:47PM +0100, Pino Toscano wrote:
If it is not possible to detect the distribution of a Linux OS, do
not
propose "unknownX.Y" (where X is the major version number, and Y the
minor) as short osinfo ID. Just return "unknown" instead.
---
lib/inspect-osinfo.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/inspect-osinfo.c b/lib/inspect-osinfo.c
index ba07e4564..d2272dfdd 100644
--- a/lib/inspect-osinfo.c
+++ b/lib/inspect-osinfo.c
@@ -70,7 +70,7 @@ guestfs_impl_inspect_get_osinfo (guestfs_h *g, const char *root)
return safe_asprintf (g, "%s%d.%d", distro, major, minor);
}
- if (major > 0 || minor > 0)
+ if (STRNEQ (distro, "unknown") && (major > 0 || minor > 0))
return safe_asprintf (g, "%s%d.%d", distro, major, minor);
}
else if (STREQ (type, "freebsd") || STREQ (type, "netbsd") ||
STREQ (type, "openbsd"))
--
ACK
Rich.
--
Richard Jones, Virtualization Group, Red Hat
http://people.redhat.com/~rjones
Read my programming and virtualization blog:
http://rwmj.wordpress.com
virt-p2v converts physical machines to virtual machines. Boot with a
live CD or over the network (PXE) and turn machines into KVM guests.
http://libguestfs.org/virt-v2v