[glib/glib-2-58: 1/2] gtimezone: Fallback to /etc/timezone on Gentoo
- From: Emmanuele Bassi <ebassi src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib/glib-2-58: 1/2] gtimezone: Fallback to /etc/timezone on Gentoo
- Date: Mon, 17 Dec 2018 17:33:17 +0000 (UTC)
commit 062f185e3c0561374daf9fca5d0fdf73747b947d
Author: Mart Raudsepp <leio gentoo org>
Date: Mon Dec 17 00:42:39 2018 +0200
gtimezone: Fallback to /etc/timezone on Gentoo
On non-systemd Gentoo systems the chosen timezone is expressed in
/etc/timezone and /etc/localtime may be a copy of the timezone
file instead of symlink. Add this path to the fallback test to
not regress dates into UTC.
glib/gtimezone.c | 17 +++++++++++------
1 file changed, 11 insertions(+), 6 deletions(-)
---
diff --git a/glib/gtimezone.c b/glib/gtimezone.c
index b3220dc35..5189824f9 100644
--- a/glib/gtimezone.c
+++ b/glib/gtimezone.c
@@ -447,12 +447,17 @@ zone_info_unix (const gchar *identifier,
G_FILE_ERROR_INVAL);
g_clear_error (&read_link_err);
- /* Fallback to the content of /var/db/zoneinfo if /etc/localtime is
- * not a symlink. This is where 'tzsetup' program on FreeBSD and
- * DragonflyBSD stores the timezone chosen by the user. */
- if (not_a_symlink && g_file_get_contents ("/var/db/zoneinfo",
- &resolved_identifier,
- NULL, NULL))
+ /* Fallback to the content of /var/db/zoneinfo or /etc/timezone
+ * if /etc/localtime is not a symlink. /var/db/zoneinfo is
+ * where 'tzsetup' program on FreeBSD and DragonflyBSD stores
+ * the timezone chosen by the user. /etc/timezone is where user
+ * choice is expressed on Gentoo OpenRC and others. */
+ if (not_a_symlink && (g_file_get_contents ("/var/db/zoneinfo",
+ &resolved_identifier,
+ NULL, NULL) ||
+ g_file_get_contents ("/etc/timezone",
+ &resolved_identifier,
+ NULL, NULL)))
g_strchomp (resolved_identifier);
else
{
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]