From dd8affc6de5755e07638bf0a14382d29549d6ee9 Mon Sep 17 00:00:00 2001 From: Julien Blanc Date: Tue, 1 Oct 2024 12:00:00 +0200 Subject: [PATCH] Fix current_zone not working on buildroot+glibc target - refs #846 The layout for timezones, on these targets, is `/usr/share/zoneinfo/posix/Europe/Paris` instead of `/usr/share/zoneinfo/Europe/Paris`. `/usr/share/zoneinfo/Europe/Paris` exists and is a symlink to `/usr/share/zoneinfo/posix/Europe/Paris`. `/etc/localtime` correctly links to `/usr/share/zoneinfo/Europe/Paris`, so `readlink` must be used instead of `realpath`. Signed-off-by: Julien Blanc --- src/tz.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/tz.cpp b/src/tz.cpp index 511b1dc..15c9f5d 100644 --- a/src/tz.cpp +++ b/src/tz.cpp @@ -4187,6 +4187,8 @@ sniff_realpath(const char* timezone) if (rp.get() == nullptr) throw system_error(errno, system_category(), "realpath() failed"); auto result = extract_tz_name(rp.get()); + if (result.find("posix") == 0) + return false; return result != "posixrules"; }