1
0
Fork 1
mirror of https://github.com/NixOS/nixpkgs.git synced 2024-11-21 13:10:33 +00:00
nixpkgs/pkgs/development/libraries/libical/respect-env-tzdir.patch

28 lines
968 B
Diff

--- a/src/libical/icaltz-util.c 2015-06-11 15:40:58.843138630 +0200
+++ b/src/libical/icaltz-util.c 2015-06-11 15:43:12.722046252 +0200
@@ -107,7 +107,7 @@
char charcnt[4];
} tzinfo;
-static char *search_paths [] = {"/usr/share/zoneinfo","/usr/lib/zoneinfo","/etc/zoneinfo","/usr/share/lib/zoneinfo"};
+static char *search_paths [] = {"/etc/zoneinfo","/usr/share/zoneinfo","/usr/lib/zoneinfo","/usr/share/lib/zoneinfo"};
static char *zdir = NULL;
#define NUM_SEARCH_PATHS (sizeof (search_paths)/ sizeof (search_paths [0]))
@@ -194,6 +194,15 @@
const char *fname = ZONES_TAB_SYSTEM_FILENAME;
unsigned int i;
+ const char *env_tzdir = getenv ("TZDIR");
+ if (env_tzdir) {
+ sprintf (file_path, "%s/%s", env_tzdir, fname);
+ if (!access (file_path, F_OK|R_OK)) {
+ zdir = env_tzdir;
+ return;
+ }
+ }
+
for (i = 0; i < NUM_SEARCH_PATHS; i++) {
sprintf (file_path, "%s/%s", search_paths [i], fname);
if (!access (file_path, F_OK|R_OK)) {