]> git.ipfire.org Git - thirdparty/vim.git/commitdiff
patch 7.4.1889 v7.4.1889
authorBram Moolenaar <Bram@vim.org>
Sat, 4 Jun 2016 12:52:00 +0000 (14:52 +0200)
committerBram Moolenaar <Bram@vim.org>
Sat, 4 Jun 2016 12:52:00 +0000 (14:52 +0200)
Problem:    When umask is set to 0177 Vim can't create temp files. (Lcd)
Solution:   Also correct umask when using mkdtemp().

src/fileio.c
src/version.c

index 5626712f3c0527bf01f26e71b1ead9644a6ee6da..c07accccadc7ad1298b4a05e022d11dfe4b8b733 100644 (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,
index e18515e117401912a71537ea01e211b4f651a17d..4ab1a255b18fa99e898bc2f34744a6ae0576d23a 100644 (file)
@@ -753,6 +753,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    1889,
 /**/
     1888,
 /**/