diff src/fileio.c @ 2003:5d5cad78a838 v7.2.300

updated for version 7.2-300
author vimboss
date Tue, 17 Nov 2009 16:13:15 +0000
parents 98cdf5c477ec
children 78e032bb3260
line wrap: on
line diff
--- a/src/fileio.c
+++ b/src/fileio.c
@@ -2254,6 +2254,14 @@ failed:
 
     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