aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorvlm <vlm@59561ff5-6e30-0410-9f3c-9617f08c8826>2007-10-02 11:03:02 +0000
committervlm <vlm@59561ff5-6e30-0410-9f3c-9617f08c8826>2007-10-02 11:03:02 +0000
commitaa7d089282f5473f588c0243a2018818dc0cc52c (patch)
treee8544692157e15c9b0c7a9bb193b13fd107b99b0
parent83b901d8e98c769f66031df68196b6ca0583b0bb (diff)
Fixed [1579558] (TZ longer than 64 chars on solaris, with FREEMEM redefined).
git-svn-id: https://asn1c.svn.sourceforge.net/svnroot/asn1c/trunk@1390 59561ff5-6e30-0410-9f3c-9617f08c8826
-rw-r--r--skeletons/GeneralizedTime.c9
1 files 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(); \