mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
vim-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().
35d88f4e2f
This commit is contained in:
parent
efe1476d42
commit
bfb5180627
@ -51,6 +51,7 @@
|
|||||||
#include "nvim/window.h"
|
#include "nvim/window.h"
|
||||||
#include "nvim/shada.h"
|
#include "nvim/shada.h"
|
||||||
#include "nvim/os/os.h"
|
#include "nvim/os/os.h"
|
||||||
|
#include "nvim/os/os_defs.h"
|
||||||
#include "nvim/os/time.h"
|
#include "nvim/os/time.h"
|
||||||
#include "nvim/os/input.h"
|
#include "nvim/os/input.h"
|
||||||
|
|
||||||
@ -5224,6 +5225,10 @@ static void vim_maketempdir(void)
|
|||||||
// Try the entries in `TEMP_DIR_NAMES` to create the temp directory.
|
// Try the entries in `TEMP_DIR_NAMES` to create the temp directory.
|
||||||
char_u template[TEMP_FILE_PATH_MAXLEN];
|
char_u template[TEMP_FILE_PATH_MAXLEN];
|
||||||
char_u path[TEMP_FILE_PATH_MAXLEN];
|
char_u path[TEMP_FILE_PATH_MAXLEN];
|
||||||
|
|
||||||
|
// Make sure the umask doesn't remove the executable bit.
|
||||||
|
// "repl" has been reported to use "0177".
|
||||||
|
mode_t umask_save = umask(0077);
|
||||||
for (size_t i = 0; i < ARRAY_SIZE(temp_dirs); i++) {
|
for (size_t i = 0; i < ARRAY_SIZE(temp_dirs); i++) {
|
||||||
// Expand environment variables, leave room for "/nvimXXXXXX/999999999"
|
// Expand environment variables, leave room for "/nvimXXXXXX/999999999"
|
||||||
expand_env((char_u *)temp_dirs[i], template, TEMP_FILE_PATH_MAXLEN - 22);
|
expand_env((char_u *)temp_dirs[i], template, TEMP_FILE_PATH_MAXLEN - 22);
|
||||||
@ -5247,6 +5252,7 @@ static void vim_maketempdir(void)
|
|||||||
os_rmdir((char *)path);
|
os_rmdir((char *)path);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
(void)umask(umask_save);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Delete "name" and everything in it, recursively.
|
/// Delete "name" and everything in it, recursively.
|
||||||
|
@ -551,7 +551,7 @@ static int included_patches[] = {
|
|||||||
1892,
|
1892,
|
||||||
// 1891 NA
|
// 1891 NA
|
||||||
// 1890 NA
|
// 1890 NA
|
||||||
// 1889,
|
1889,
|
||||||
// 1888 NA
|
// 1888 NA
|
||||||
// 1887 NA
|
// 1887 NA
|
||||||
// 1886 NA
|
// 1886 NA
|
||||||
|
Loading…
Reference in New Issue
Block a user