Moved put_tz into set_tz to scope it better.

Increased put_tz to 256 bytes.  TZ can be a path.

"TZ=" isn't the same as TZ not existing.  If TZ isn't set, don't restore
it to "".  (This is interpreted as an unknown timezone by my system, and
I end up with GMT times.)

-- 
Glenn Maynard
Index: misc.cc
===================================================================
RCS file: /home/lav/cvsroot/lftp/src/misc.cc,v
retrieving revision 1.39
diff -u -r1.39 misc.cc
--- misc.cc     2001/10/27 10:56:18     1.39
+++ misc.cc     2001/10/28 23:34:08
@@ -497,12 +497,14 @@
    return (tl <= tb ? (tl + (tl - tb)) : (tl - (tb - tl)));
 }
 
-static char put_tz[64];
 static void set_tz(const char *tz)
 {
-   if(!tz)
-      tz="";
-   sprintf(put_tz,"TZ=%.60s",tz);
+   static char put_tz[256];
+   if(!tz) {
+      unsetenv("TZ");
+      return;
+   }
+   sprintf(put_tz,"TZ=%.250s",tz);
    putenv(put_tz);
 }
 static char *saved_tz=0;

Reply via email to