diff options
author | Eli Zaretskii <eliz@gnu.org> | 2004-04-27 14:22:05 +0000 |
---|---|---|
committer | Eli Zaretskii <eliz@gnu.org> | 2004-04-27 14:22:05 +0000 |
commit | 319cb37860772790bedc54083dec5b17e34db625 (patch) | |
tree | 3e5cf9f352043fc1b5b6c328e63b876801e5151d /src/msdos.c | |
parent | 7844257c6e87f2f415007c28f6b1e7561abe3206 (diff) | |
download | emacs-319cb37860772790bedc54083dec5b17e34db625.tar.gz |
(init_environment): If one of the TMP... environment
variables is set to a drive letter without a trailing slash,
append a slash.
Diffstat (limited to 'src/msdos.c')
-rw-r--r-- | src/msdos.c | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/src/msdos.c b/src/msdos.c index c58dc6875fe..47fdf7fa03d 100644 --- a/src/msdos.c +++ b/src/msdos.c @@ -4408,9 +4408,28 @@ init_environment (argc, argv, skip_args) 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 |