summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2016-06-04 14:52:00 +0200
committerBram Moolenaar <Bram@vim.org>2016-06-04 14:52:00 +0200
commit35d88f4e2ff5dcd9904f04612d5febede996137c (patch)
tree38479c0cea567a8ad53c10b3dc5c6609b4334a1c
parent76b6dfe54ba9b85cd9d8e6539205c1679a187961 (diff)
downloadvim-git-35d88f4e2ff5dcd9904f04612d5febede996137c.tar.gz
patch 7.4.1889v7.4.1889
Problem: When umask is set to 0177 Vim can't create temp files. (Lcd) Solution: Also correct umask when using mkdtemp().
-rw-r--r--src/fileio.c18
-rw-r--r--src/version.c2
2 files changed, 16 insertions, 4 deletions
diff --git a/src/fileio.c b/src/fileio.c
index 5626712f3..c07acccca 100644
--- a/src/fileio.c
+++ b/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,
diff --git a/src/version.c b/src/version.c
index e18515e11..4ab1a255b 100644
--- a/src/version.c
+++ b/src/version.c
@@ -754,6 +754,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 1889,
+/**/
1888,
/**/
1887,