[Libguestfs] [PATCH 3/3] inspect: revamp icon extraction for *SUSE guests

Pino Toscano ptoscano at redhat.com
Wed Feb 6 14:26:46 UTC 2019


Newer versions do not have the 24px distributor.png icon; OTOH they have
the 48px version, so look for that one before the 24px one.

Also, bump the size limit to 10K, as newer versions of the icon are
bigger than 3K.
---
 lib/inspect-icon.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/lib/inspect-icon.c b/lib/inspect-icon.c
index 0cc8e92ad..623591aa6 100644
--- a/lib/inspect-icon.c
+++ b/lib/inspect-icon.c
@@ -354,12 +354,16 @@ icon_mageia (guestfs_h *g, size_t *size_r)
   return get_png (g, MAGEIA_ICON, size_r, 10240);
 }
 
-#define OPENSUSE_ICON "/usr/share/icons/hicolor/24x24/apps/distributor.png"
-
 static char *
 icon_opensuse (guestfs_h *g, size_t *size_r)
 {
-  return get_png (g, OPENSUSE_ICON, size_r, 2048);
+  const char *icons[] = {
+    "/usr/share/icons/hicolor/48x48/apps/distributor.png",
+    "/usr/share/icons/hicolor/24x24/apps/distributor.png",
+    NULL
+  };
+
+  return find_png (g, icons, size_r, 10240);
 }
 
 #if CAN_DO_CIRROS
-- 
2.20.1




More information about the Libguestfs mailing list