mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2024-11-10 11:26:16 +01:00
gtimezone: Fix symlink checks on relative link targets
The changes in 6265b2e6f7
to reject weird
`/etc/localtime` configurations where `/etc/localtime` links to another
symlink did not consider the case where the target of `/etc/localtime`
is a *relative* path. They only considered the case where the target is
absolute.
Relative paths are permissible in all symlinks. On my Fedora 36 system,
`/etc/localtime`’s target is `../usr/share/zoneinfo/Europe/London`.
Fix the check for toolbx by resolving relative paths before calling
`g_lstat()` on them.
Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
This commit is contained in:
parent
662661a8d0
commit
f8c80391ae
@ -544,6 +544,13 @@ zone_identifier_unix (void)
|
|||||||
|
|
||||||
if (resolved_identifier != NULL)
|
if (resolved_identifier != NULL)
|
||||||
{
|
{
|
||||||
|
if (!g_path_is_absolute (resolved_identifier))
|
||||||
|
{
|
||||||
|
gchar *absolute_resolved_identifier = g_build_filename ("/etc", resolved_identifier, NULL);
|
||||||
|
g_free (resolved_identifier);
|
||||||
|
resolved_identifier = g_steal_pointer (&absolute_resolved_identifier);
|
||||||
|
}
|
||||||
|
|
||||||
if (g_lstat (resolved_identifier, &file_status) == 0)
|
if (g_lstat (resolved_identifier, &file_status) == 0)
|
||||||
{
|
{
|
||||||
if ((file_status.st_mode & S_IFMT) != S_IFREG)
|
if ((file_status.st_mode & S_IFMT) != S_IFREG)
|
||||||
|
Loading…
Reference in New Issue
Block a user