From 2fe66ca74314dd1550ae0984ea753314fa4dc859 Mon Sep 17 00:00:00 2001 From: Lev Walkin Date: Tue, 2 Oct 2007 11:03:02 +0000 Subject: [PATCH] Fixed [1579558] (TZ longer than 64 chars on solaris, with FREEMEM redefined). --- skeletons/GeneralizedTime.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/skeletons/GeneralizedTime.c b/skeletons/GeneralizedTime.c index 653849a3..10b73ad2 100644 --- a/skeletons/GeneralizedTime.c +++ b/skeletons/GeneralizedTime.c @@ -105,10 +105,13 @@ static long GMTOFF(struct tm a){ tzold = getenv("TZ"); \ if(tzold) { \ size_t tzlen = strlen(tzold); \ - if(tzlen < sizeof(tzoldbuf)) \ + if(tzlen < sizeof(tzoldbuf)) { \ tzold = memcpy(tzoldbuf, tzold, tzlen + 1); \ - else \ - tzold = strdup(tzold); /* Ignore error */ \ + } else { \ + char *dupptr = tzold; + tzold = MALLOC(tzlen + 1); \ + if(tzold) memcpy(tzold, dupptr, tzlen + 1); \ + } \ setenv("TZ", "UTC", 1); \ } \ tzset(); \