mirror of
https://github.com/libguestfs/libguestfs.git
synced 2026-03-22 07:03:38 +00:00
inspection: Allow /etc/favicon.png to be a symbolic link (RHBZ#1164619).
If /etc/favicon.png is a symbolic link, follow it.
Unfortunately RHEL 7 and Fedora have crappy 16x16 /etc/favicon.png
symlinks in the base distro. It would be nice to ignore this symlink,
but it's almost impossible to determine if the symlink is part of the
base distro or was added by the user. (This is a bug in those
distros.) virt-inspector and virt-mananger both ignore favicons.
(cherry picked from commit 4239191328)
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user