nixpkgs/pkgs/development/libraries/libical/respect-env-tzdir.patch

30 lines
829 B
Diff
Raw Normal View History

2017-09-18 01:25:11 +00:00
--- a/src/libical/icaltz-util.c
+++ b/src/libical/icaltz-util.c
2018-06-29 10:49:33 +00:00
@@ -94,9 +94,9 @@
static const char *zdir = NULL;
2018-06-29 10:49:33 +00:00
static const char *search_paths[] = {
2017-09-18 01:25:11 +00:00
+ "/etc/zoneinfo",
"/usr/share/zoneinfo",
"/usr/lib/zoneinfo",
- "/etc/zoneinfo",
"/usr/share/lib/zoneinfo"
};
2018-06-29 10:49:33 +00:00
@@ -178,6 +178,15 @@
2017-09-18 01:25:11 +00:00
const char *fname = ZONES_TAB_SYSTEM_FILENAME;
size_t i, num_search_paths;
2017-09-18 01:25:11 +00:00
+ const char *env_tzdir = getenv ("TZDIR");
+ if (env_tzdir) {
2018-06-29 10:49:33 +00:00
+ sprintf (file_path, "%s/%s", env_tzdir, fname);
2017-09-18 01:25:11 +00:00
+ if (!access (file_path, F_OK|R_OK)) {
+ zdir = env_tzdir;
+ return;
+ }
+ }
+
2017-09-18 01:25:11 +00:00
num_search_paths = sizeof(search_paths) / sizeof(search_paths[0]);
for (i = 0; i < num_search_paths; i++) {
snprintf(file_path, MAXPATHLEN, "%s/%s", search_paths[i], fname);