mirror of
https://github.com/varun-r-mallya/sysprof.git
synced 2026-02-12 16:10:54 +00:00
elfparser: Try original filename too
Fixes Sysprof running under Flatpak (e.g. from Builder) being unable to resolve any paths on Silverblue.
This commit is contained in:
@ -278,13 +278,21 @@ static GMappedFile *
|
|||||||
open_mapped_file (const char *filename,
|
open_mapped_file (const char *filename,
|
||||||
GError **error)
|
GError **error)
|
||||||
{
|
{
|
||||||
GMappedFile *file;
|
GMappedFile *file = NULL;
|
||||||
char *alternate = NULL;
|
char *alternate = NULL;
|
||||||
|
|
||||||
if (in_container () && !g_str_has_prefix (filename, g_get_home_dir ()))
|
if (in_container () && !g_str_has_prefix (filename, g_get_home_dir ()))
|
||||||
filename = alternate = g_build_filename ("/var/run/host", filename, NULL);
|
{
|
||||||
file = g_mapped_file_new (filename, FALSE, error);
|
alternate = g_build_filename ("/var/run/host", filename, NULL);
|
||||||
g_free (alternate);
|
file = g_mapped_file_new (alternate, FALSE, NULL);
|
||||||
|
g_free (alternate);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Flatpaks with filesystem=host don't have Silverblue's /sysroot in /var/run/host,
|
||||||
|
* yet they have it in /, which means the original path might work.
|
||||||
|
*/
|
||||||
|
if (!file)
|
||||||
|
file = g_mapped_file_new (filename, FALSE, error);
|
||||||
|
|
||||||
return file;
|
return file;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user