Date: Mon, 21 Apr 1997 14:05:19 +0300 (IDT) From: Eli Zaretskii To: K DOT Ashley AT ulcc DOT ac DOT uk cc: CZIWKGA AT vmsfe DOT ulcc DOT ac DOT uk, djgpp AT delorie DOT com Subject: Re: Zoneinfo bug in EMACS? (Eli?) In-Reply-To: <970421095922.20202668@vmsfe.ulcc.ac.uk> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Precedence: bulk On Mon, 21 Apr 1997, Kevin Ashley, Systems Development, ULCC wrote: > throughout all the routines. The fact that the library does this only > increases my respect for those of you who worked on it - I wouldn't be > confident that every libc implementation on other platforms offers me > the same. Emacs has all kinds of workarounds for common cases of functions that aren't safe in this context. So the issue is really to be no worse than the typical Unix libc. > >Did you see the patch that I posted? If so, was it too complicated? I > >don't think so. > > I didn't see it, no, and I can't find it on our news server. (This is no > surprise - I suspect we only ever see 50-70% of most messages to most groups, > but that's my problem.) Maybe I just didn't post it to c.o.m.d. Here it is (note that it also corrects another problem, with DOS pathnames with drive letters): *** src/libc/ansi/time/ctime.c~0 Tue Apr 15 13:57:30 1997 --- src/libc/ansi/time/ctime.c Tue Apr 15 15:58:32 1997 *************** *** 1,3 **** --- 1,4 ---- + /* Copyright (C) 1997 DJ Delorie, see COPYING.DJ for details */ /* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */ /* This file has been modified by DJ Delorie. These modifications are ** Copyright (C) 1995 DJ Delorie, 24 Kirsten Ave, Rochester NH, *************** static char sccsid[] = "@(#)ctime.c 5.23 *** 47,52 **** --- 48,54 ---- #include #include + #include #include "posixrul.h" *************** settzname(void) *** 232,238 **** static char * tzdir(void) { ! static char dir[80]={0}, *cp; if (dir[0] == 0) { if ((cp = getenv("TZDIR"))) --- 234,248 ---- static char * tzdir(void) { ! static char dir[FILENAME_MAX + 1]={0}, *cp; ! static int tzdir_bss_count = -1; ! ! /* Force recomputation of cached values (Emacs). */ ! if (tzdir_bss_count != __bss_count) ! { ! tzdir_bss_count = __bss_count; ! dir[0] = 0; ! } if (dir[0] == 0) { if ((cp = getenv("TZDIR"))) *************** tzload(const char *name, struct state * *** 266,272 **** if (name[0] == ':') ++name; ! if (name[0] != '/') { if ((p = tzdir()) == NULL) return -1; --- 276,282 ---- if (name[0] == ':') ++name; ! if (name[0] && name[0] != '/' && name[0] != '\\' && name[1] != ':') { if ((p = tzdir()) == NULL) return -1; *************** tzload(const char *name, struct state * *** 281,286 **** --- 291,301 ---- if ((fid = open(name, OPEN_MODE)) == -1) { const char *base = strrchr(name, '/'); + const char *bslash = strrchr(name, '\\'); + if (bslash && (!base || bslash > base)) + base = bslash; + if (!base && name[1] == ':') + base = name + 1; if (base) base++; else