aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorEli Zaretskii2004-04-27 14:22:05 +0000
committerEli Zaretskii2004-04-27 14:22:05 +0000
commit319cb37860772790bedc54083dec5b17e34db625 (patch)
tree3e5cf9f352043fc1b5b6c328e63b876801e5151d /src
parent7844257c6e87f2f415007c28f6b1e7561abe3206 (diff)
downloademacs-319cb37860772790bedc54083dec5b17e34db625.tar.gz
emacs-319cb37860772790bedc54083dec5b17e34db625.zip
(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')
-rw-r--r--src/msdos.c21
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)
4408 for (i = 0; i < imax ; i++) 4408 for (i = 0; i < imax ; i++)
4409 { 4409 {
4410 const char *tmp = tempdirs[i]; 4410 const char *tmp = tempdirs[i];
4411 char buf[FILENAME_MAX];
4411 4412
4412 if (*tmp == '$') 4413 if (*tmp == '$')
4413 tmp = getenv (tmp + 1); 4414 {
4415 int tmp_len;
4416
4417 tmp = getenv (tmp + 1);
4418 if (!tmp)
4419 continue;
4420
4421 /* Some lusers set TMPDIR=e:, probably because some losing
4422 programs cannot handle multiple slashes if they use e:/.
4423 e: fails in `access' below, so we interpret e: as e:/. */
4424 tmp_len = strlen(tmp);
4425 if (tmp[tmp_len - 1] != '/' && tmp[tmp_len - 1] != '\\')
4426 {
4427 strcpy(buf, tmp);
4428 buf[tmp_len++] = '/', buf[tmp_len] = 0;
4429 tmp = buf;
4430 }
4431 }
4432
4414 /* Note that `access' can lie to us if the directory resides on a 4433 /* Note that `access' can lie to us if the directory resides on a
4415 read-only filesystem, like CD-ROM or a write-protected floppy. 4434 read-only filesystem, like CD-ROM or a write-protected floppy.
4416 The only way to be really sure is to actually create a file and 4435 The only way to be really sure is to actually create a file and