timezone: Correctly resolve symlink from /etc/localtimecb326143822f3ebc94f48e7ff6f9567275d0053c
commitcb326143822f3ebc94f48e7ff6f9567275d0053c
authorGeorges Basile Stavracas Neto <georges.stavracas@gmail.com>
Fri, 27 Apr 2018 16:02:21 +0000 (27 13:02 -0300)
committerPhilip Withnall <withnall@endlessm.com>
Mon, 30 Apr 2018 20:59:22 +0000 (30 21:59 +0100)
tree5d89529792cbe4164859a1d3197d1e033477982b
parent0f37af7e9bf0bb897e936c85df3261874fe6aa74
timezone: Correctly resolve symlink from /etc/localtime

The return value of g_file_read_link ("/etc/localtime") can
be a relative path in the form of "../usr/share/zoneinfo".
This breaks the prefix check that is performed, and makes
the timezone identifier be "../usr/share/zoneinfo/America/Sao_Paulo",
for example, which breaks other parts of the system.

Fix that by canonicalizing the symlink path if we detect
is it a relative path.

(Tweaked by Philip Withnall <withnall@endlessm.com> to remove a
conditional which was unnecessary.)

https://bugzilla.gnome.org/show_bug.cgi?id=111848
glib/gtimezone.c