updated for version 7.2-300
diff --git a/src/auto/configure b/src/auto/configure
index eb683c1..7230ce3 100755
--- a/src/auto/configure
+++ b/src/auto/configure
Binary files differ
diff --git a/src/config.h.in b/src/config.h.in
index 0d39b43..2b2730e 100644
--- a/src/config.h.in
+++ b/src/config.h.in
@@ -388,3 +388,6 @@
/* Define if you want XSMP interaction as well as vanilla swapfile safety */
#undef USE_XSMP_INTERACT
+
+/* Define if fcntl()'s F_SETFD command knows about FD_CLOEXEC */
+#undef HAVE_FD_CLOEXEC
diff --git a/src/configure.in b/src/configure.in
index f994677..727bfd1 100644
--- a/src/configure.in
+++ b/src/configure.in
@@ -2855,6 +2855,16 @@
AC_MSG_RESULT(yes)
fi
+dnl make sure the FD_CLOEXEC flag for fcntl()'s F_SETFD command is known
+AC_MSG_CHECKING(for FD_CLOEXEC)
+AC_TRY_COMPILE(
+[#if HAVE_FCNTL_H
+# include <fcntl.h>
+#endif],
+[ int flag = FD_CLOEXEC;],
+ AC_MSG_RESULT(yes); AC_DEFINE(HAVE_FD_CLOEXEC),
+ AC_MSG_RESULT(not usable))
+
dnl rename needs to be checked separately to work on Nextstep with cc
AC_MSG_CHECKING(for rename)
AC_TRY_LINK([#include <stdio.h>], [rename("this", "that")],
diff --git a/src/fileio.c b/src/fileio.c
index fa07afe..b0b341a 100644
--- a/src/fileio.c
+++ b/src/fileio.c
@@ -2254,6 +2254,14 @@
if (!read_buffer && !read_stdin)
close(fd); /* errors are ignored */
+#ifdef HAVE_FD_CLOEXEC
+ else
+ {
+ int fdflags = fcntl(fd, F_GETFD);
+ if (fdflags >= 0 && (fdflags & FD_CLOEXEC) == 0)
+ fcntl(fd, F_SETFD, fdflags | FD_CLOEXEC);
+ }
+#endif
vim_free(buffer);
#ifdef HAVE_DUP
diff --git a/src/memfile.c b/src/memfile.c
index 0b3cdd9..bd03e65 100644
--- a/src/memfile.c
+++ b/src/memfile.c
@@ -1343,6 +1343,11 @@
}
else
{
+#ifdef HAVE_FD_CLOEXEC
+ int fdflags = fcntl(mfp->mf_fd, F_GETFD);
+ if (fdflags >= 0 && (fdflags & FD_CLOEXEC) == 0)
+ fcntl(mfp->mf_fd, F_SETFD, fdflags | FD_CLOEXEC);
+#endif
#ifdef HAVE_SELINUX
mch_copy_sec(fname, mfp->mf_fname);
#endif
diff --git a/src/memline.c b/src/memline.c
index facdeb6..480e93c 100644
--- a/src/memline.c
+++ b/src/memline.c
@@ -382,7 +382,7 @@
dp->db_index[0] = --dp->db_txt_start; /* at end of block */
dp->db_free -= 1 + INDEX_SIZE;
dp->db_line_count = 1;
- *((char_u *)dp + dp->db_txt_start) = NUL; /* emtpy line */
+ *((char_u *)dp + dp->db_txt_start) = NUL; /* empty line */
return OK;
@@ -490,6 +490,13 @@
EMSG(_("E301: Oops, lost the swap file!!!"));
return;
}
+#ifdef HAVE_FD_CLOEXEC
+ {
+ int fdflags = fcntl(mfp->mf_fd, F_GETFD);
+ if (fdflags >= 0 && (fdflags & FD_CLOEXEC) == 0)
+ fcntl(mfp->mf_fd, F_SETFD, fdflags | FD_CLOEXEC);
+ }
+#endif
}
if (!success)
EMSG(_("E302: Could not rename swap file"));
diff --git a/src/version.c b/src/version.c
index 1460a8d..a889332 100644
--- a/src/version.c
+++ b/src/version.c
@@ -682,6 +682,8 @@
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 300,
+/**/
299,
/**/
298,