X-Authentication-Warning: delorie.com: mail set sender to djgpp-workers-bounces using -f Date: Thu, 2 Aug 2007 18:42:41 +0200 From: Egon Eckert To: djgpp-workers AT delorie DOT com Subject: small bug(?) in tzset() Message-ID: <20070802164241.GB23442@heaven.industries.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.13 (2006-08-11) Reply-To: djgpp-workers AT delorie DOT com Hi, I suspect there's a small bug in tzset(). When I do putenv("TZ=..."); tzset(); unsetenv("TZ"); tzset(); the second tzset() call does nothing (and thus the obsolete TZ setting remains valid, which is bad). I think this behavior was introduced with this optimization: http://www.delorie.com/bin/cvsweb.cgi/djgpp/src/libc/ansi/time/ctime.c.diff?r1=1.8&r2=1.9 and hopefully would be fixed with this change: --- a/src/libc/ansi/time/ctime.c 2002-11-30 06:35:58.000000000 +0100 +++ b/src/libc/ansi/time/ctime.c 2007-08-02 16:25:40.000000000 +0200 @@ -929,7 +929,7 @@ name = getenv("TZ"); /* Use stricmp, since if TZ points to a file name, we need to be case-insensitive. */ - if (lcl_is_set > 0 && (name == NULL || stricmp(name, lcl_tzstr) == 0)) + if (lcl_is_set > 0 && stricmp(name ? name : "", lcl_tzstr) == 0) return; /* On to some *real* work... */ @@ -937,6 +937,7 @@ { tzsetwall(); lcl_is_set = 1; + lcl_tzstr[0] = 0; return; } if (strlen(name) < sizeof(lcl_tzstr)) if it's right and fits your taste :). Sorry if I'm wrong. Regards, -- Egon Eckert, Heaven Industries, s.r.o. E-mail: egon AT heaven DOT industries DOT cz EARTH smog | bricks AIR -- mud -- FIRE soda water | tequila WATER -- with thanks to fortune