[Libguestfs] [PATCH] inspection: lift size limit for RHEL icons

Pino Toscano ptoscano at redhat.com
Fri May 29 14:01:25 UTC 2015


In RHEL-based distros, the provided icons have (obviously) different
sizes than the RHEL ones, used in icon_rhel as reference.

Since 100K should be a reasonable threshold for avoid keeping a
per-distro list of limits, just use it as only size limit.
---
 src/inspect-icon.c | 11 ++++-------
 1 file changed, 4 insertions(+), 7 deletions(-)

diff --git a/src/inspect-icon.c b/src/inspect-icon.c
index fb998c2..c83ba13 100644
--- a/src/inspect-icon.c
+++ b/src/inspect-icon.c
@@ -318,24 +318,21 @@ icon_fedora (guestfs_h *g, struct inspect_fs *fs, size_t *size_r)
  *
  * Conveniently the RHEL clones also have the same file with the
  * same name, but containing their own logos.  Sense prevails!
+ *
+ * Use a generic 100K limit for all the images, as logos in the
+ * RHEL clones have different sizes.
  */
 static char *
 icon_rhel (guestfs_h *g, struct inspect_fs *fs, size_t *size_r)
 {
-  size_t max_size = 0;
   const char *shadowman;
 
-  if (fs->major_version >= 5 && fs->major_version <= 6)
-    max_size = 17000;
-  else
-    max_size = 66000;
-
   if (fs->major_version <= 6)
     shadowman = "/usr/share/pixmaps/redhat/shadowman-transparent.png";
   else
     shadowman = "/usr/share/pixmaps/fedora-logo-sprite.png";
 
-  return get_png (g, fs, shadowman, size_r, max_size);
+  return get_png (g, fs, shadowman, size_r, 102400);
 }
 
 #define DEBIAN_ICON "/usr/share/pixmaps/debian-logo.png"
-- 
2.1.0




More information about the Libguestfs mailing list