# HG changeset patch # User Eli Zaretskii # Date 1083075725 0 # Node ID dabd7326e5960d0a2e029081604bf23ac89b2e7a # Parent 048eee9ae6ae34ebdc34f9918c5b10a772359509 (init_environment): If one of the TMP... environment variables is set to a drive letter without a trailing slash, append a slash. diff -r 048eee9ae6ae -r dabd7326e596 src/msdos.c --- a/src/msdos.c Tue Apr 27 14:03:10 2004 +0000 +++ b/src/msdos.c Tue Apr 27 14:22:05 2004 +0000 @@ -4408,9 +4408,28 @@ for (i = 0; i < imax ; i++) { const char *tmp = tempdirs[i]; + char buf[FILENAME_MAX]; if (*tmp == '$') - tmp = getenv (tmp + 1); + { + int tmp_len; + + tmp = getenv (tmp + 1); + if (!tmp) + continue; + + /* Some lusers set TMPDIR=e:, probably because some losing + programs cannot handle multiple slashes if they use e:/. + e: fails in `access' below, so we interpret e: as e:/. */ + tmp_len = strlen(tmp); + if (tmp[tmp_len - 1] != '/' && tmp[tmp_len - 1] != '\\') + { + strcpy(buf, tmp); + buf[tmp_len++] = '/', buf[tmp_len] = 0; + tmp = buf; + } + } + /* Note that `access' can lie to us if the directory resides on a read-only filesystem, like CD-ROM or a write-protected floppy. The only way to be really sure is to actually create a file and