summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
Diffstat (limited to 'source3')
-rw-r--r--source3/lib/replace.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/source3/lib/replace.c b/source3/lib/replace.c
index afdf32dbe8..dfc88e7028 100644
--- a/source3/lib/replace.c
+++ b/source3/lib/replace.c
@@ -438,15 +438,18 @@ char *rep_inet_ntoa(struct in_addr ip)
{
time_t ret;
char *tz;
+ char *tzvar;
tz = getenv("TZ");
- setenv("TZ", "", 1);
+ putenv("TZ=");
tzset();
ret = mktime(tm);
if (tz) {
- setenv("TZ", tz, 1);
+ asprintf(&tzvar, "TZ=%s", tz);
+ putenv(tzvar);
+ safe_free(tzvar);
} else {
- unsetenv("TZ");
+ putenv("TZ");
}
tzset();
return ret;