Fixed [1579558] (TZ longer than 64 chars on solaris, with FREEMEM redefined).

This commit is contained in:
Lev Walkin 2007-10-02 11:03:02 +00:00
parent 27fd0b6a46
commit 2fe66ca743
1 changed files with 6 additions and 3 deletions

View File

@ -105,10 +105,13 @@ static long GMTOFF(struct tm a){
tzold = getenv("TZ"); \ tzold = getenv("TZ"); \
if(tzold) { \ if(tzold) { \
size_t tzlen = strlen(tzold); \ size_t tzlen = strlen(tzold); \
if(tzlen < sizeof(tzoldbuf)) \ if(tzlen < sizeof(tzoldbuf)) { \
tzold = memcpy(tzoldbuf, tzold, tzlen + 1); \ tzold = memcpy(tzoldbuf, tzold, tzlen + 1); \
else \ } else { \
tzold = strdup(tzold); /* Ignore error */ \ char *dupptr = tzold;
tzold = MALLOC(tzlen + 1); \
if(tzold) memcpy(tzold, dupptr, tzlen + 1); \
} \
setenv("TZ", "UTC", 1); \ setenv("TZ", "UTC", 1); \
} \ } \
tzset(); \ tzset(); \