diff options
Diffstat (limited to 'src/fileio.c')
-rw-r--r-- | src/fileio.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/fileio.c b/src/fileio.c index fa07afe1f9..b0b341a2e2 100644 --- 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 |