On Fri, Sep 27, 2002 at 10:28:49AM +0400, Alexander V. Lukyanov wrote:
> > Yet another try (previous patch did not call settz for unset TZ).
> 
> Posted it too fast. Here is a better one.

That's one problem, but mine was another: you can't modify the static
environment from a prior putenv() call and expect it to change the
environment.  (Well, maybe that's what's supposed to happen, but it
wasn't.)  Call putenv() each time.  (Full patch attached.)

-- 
Glenn Maynard
Index: misc.cc
===================================================================
RCS file: /home/lav/cvsroot/lftp/src/misc.cc,v
retrieving revision 1.56
diff -u -r1.56 misc.cc
--- misc.cc     2002/08/05 08:51:14     1.56
+++ misc.cc     2002/09/27 08:23:56
@@ -527,6 +527,7 @@
    if(!tz)
    {
       unsetenv("TZ");
+      tzset();
       return;
    }
    static char *put_tz;
@@ -536,12 +537,15 @@
    if(tz_len>put_tz_alloc)
       new_tz=(char*)xmalloc(put_tz_alloc=tz_len);
    sprintf(new_tz,"TZ=%s",tz);
+   putenv(new_tz);
+
    if(new_tz!=put_tz)
    {
-      putenv(new_tz);
       xfree(put_tz);
       put_tz=new_tz;
    }
+   // now initialize libc variables from env TZ.
+   tzset();
 }
 static char *saved_tz=0;
 static void save_tz()

Reply via email to