base16-schemes: unstable-2024-06-21 -> unstable-2024-11-12
[NixPkgs.git] / pkgs / by-name / li / libical / respect-env-tzdir.patch
blob59d23e490e5a07218f206b59eabe6bb85541aa19
1 --- a/src/libical/icaltz-util.c
2 +++ b/src/libical/icaltz-util.c
3 @@ -94,9 +94,9 @@
4 static const char *zdir = NULL;
6 static const char *search_paths[] = {
7 + "/etc/zoneinfo",
8 "/usr/share/zoneinfo",
9 "/usr/lib/zoneinfo",
10 - "/etc/zoneinfo",
11 "/usr/share/lib/zoneinfo"
14 @@ -178,6 +178,15 @@
15 const char *fname = ZONES_TAB_SYSTEM_FILENAME;
16 size_t i, num_search_paths;
18 + const char *env_tzdir = getenv ("TZDIR");
19 + if (env_tzdir) {
20 + sprintf (file_path, "%s/%s", env_tzdir, fname);
21 + if (!access (file_path, F_OK|R_OK)) {
22 + zdir = env_tzdir;
23 + return;
24 + }
25 + }
27 num_search_paths = sizeof(search_paths) / sizeof(search_paths[0]);
28 for (i = 0; i < num_search_paths; i++) {
29 snprintf(file_path, MAXPATHLEN, "%s/%s", search_paths[i], fname);