From 09257df055ca0ca14c3c71b21d82cfa48c34c97f Mon Sep 17 00:00:00 2001 From: "sh8281.kim" Date: Fri, 8 Nov 2013 15:44:36 +0900 Subject: [PATCH] fix android timegm --- src/rt/rust_builtin.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/rt/rust_builtin.cpp b/src/rt/rust_builtin.cpp index e8141d37ff1c5..387948613e11c 100644 --- a/src/rt/rust_builtin.cpp +++ b/src/rt/rust_builtin.cpp @@ -43,12 +43,15 @@ timegm(struct tm *tm) char *tz; tz = getenv("TZ"); + if (tz) + tz = strdup(tz); setenv("TZ", "", 1); tzset(); ret = mktime(tm); - if (tz) + if (tz) { setenv("TZ", tz, 1); - else + free(tz); + } else unsetenv("TZ"); tzset(); return ret;