diff --git a/inspector/inspector.c b/inspector/inspector.c index 8b2e5785b..71795ceee 100644 --- a/inspector/inspector.c +++ b/inspector/inspector.c @@ -480,7 +480,9 @@ output_root (xmlTextWriterPtr xo, char *root) output_applications (xo, root); - /* Don't return favicon. XXX Should we? */ + /* Don't return favicon. RHEL 7 and Fedora have crappy 16x16 + * favicons in the base distro. + */ str = guestfs_inspect_get_icon (g, root, &size, GUESTFS_INSPECT_GET_ICON_FAVICON, 0, -1); diff --git a/src/inspect-icon.c b/src/inspect-icon.c index 4f10dfbec..72d4bba97 100644 --- a/src/inspect-icon.c +++ b/src/inspect-icon.c @@ -223,6 +223,7 @@ get_png (guestfs_h *g, struct inspect_fs *fs, const char *filename, size_t *size_r, size_t max_size) { char *ret; + CLEANUP_FREE char *real = NULL; CLEANUP_FREE char *type = NULL; CLEANUP_FREE char *local = NULL; int r, w, h; @@ -234,8 +235,15 @@ get_png (guestfs_h *g, struct inspect_fs *fs, const char *filename, if (r == 0) return NOT_FOUND; + /* Resolve the path, in case it's a symbolic link (as in RHEL 7). */ + guestfs_push_error_handler (g, NULL, NULL); + real = guestfs_realpath (g, filename); + guestfs_pop_error_handler (g); + if (real == NULL) + return NOT_FOUND; /* could just be a broken link */ + /* Check the file type and geometry. */ - type = guestfs_file (g, filename); + type = guestfs_file (g, real); if (!type) return NOT_FOUND; @@ -252,7 +260,7 @@ get_png (guestfs_h *g, struct inspect_fs *fs, const char *filename, if (max_size == 0) max_size = 4 * w * h; - local = guestfs___download_to_tmp (g, fs, filename, "icon", max_size); + local = guestfs___download_to_tmp (g, fs, real, "icon", max_size); if (!local) return NOT_FOUND;