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:
parent
76b6dfe54b
commit
35d88f4e2f
18
src/fileio.c
18
src/fileio.c
@ -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,
|
||||
|
@ -753,6 +753,8 @@ static char *(features[]) =
|
||||
|
||||
static int included_patches[] =
|
||||
{ /* Add new patch number below this line */
|
||||
/**/
|
||||
1889,
|
||||
/**/
|
||||
1888,
|
||||
/**/
|
||||
|
Loading…
x
Reference in New Issue
Block a user