0
0
mirror of https://github.com/vim/vim.git synced 2025-07-26 11:04:33 -04:00

patch 7.4.1889

Problem:    When umask is set to 0177 Vim can't create temp files. (Lcd)
Solution:   Also correct umask when using mkdtemp().
This commit is contained in:
Bram Moolenaar 2016-06-04 14:52:00 +02:00
parent 76b6dfe54b
commit 35d88f4e2f
2 changed files with 16 additions and 4 deletions

View File

@ -7389,10 +7389,20 @@ vim_tempname(
add_pathsep(itmp);
# ifdef HAVE_MKDTEMP
/* Leave room for filename */
STRCAT(itmp, "vXXXXXX");
if (mkdtemp((char *)itmp) != NULL)
vim_settempdir(itmp);
{
# if defined(UNIX) || defined(VMS)
/* Make sure the umask doesn't remove the executable bit.
* "repl" has been reported to use "177". */
mode_t umask_save = umask(077);
# endif
/* Leave room for filename */
STRCAT(itmp, "vXXXXXX");
if (mkdtemp((char *)itmp) != NULL)
vim_settempdir(itmp);
# if defined(UNIX) || defined(VMS)
(void)umask(umask_save);
# endif
}
# else
/* Get an arbitrary number of up to 6 digits. When it's
* unlikely that it already exists it will be faster,

View File

@ -753,6 +753,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
1889,
/**/
1888,
/**/