diff options
author | Matthew Malcomson <hardenedapple@gmail.com> | 2017-01-21 14:11:30 +0000 |
---|---|---|
committer | Justin M. Keyes <justinkz@gmail.com> | 2017-03-17 12:20:51 +0100 |
commit | f6946c68aee90c6ae8337b3e42c72943e37a507e (patch) | |
tree | 477386daf3393c1a71fec15eac3d75ec46d283d0 /src/nvim/fileio.c | |
parent | ad1884be0dcf029f7467e5cfad8ffe7c8ba461b6 (diff) | |
download | rneovim-f6946c68aee90c6ae8337b3e42c72943e37a507e.tar.gz rneovim-f6946c68aee90c6ae8337b3e42c72943e37a507e.tar.bz2 rneovim-f6946c68aee90c6ae8337b3e42c72943e37a507e.zip |
job-control: set CLOEXEC on pty processes. #5986
Before this change, new processes started with libuv prevented SIGHUP
from reaching pty processes (by keeping the ptmx file descriptor open).
Diffstat (limited to 'src/nvim/fileio.c')
-rw-r--r-- | src/nvim/fileio.c | 13 |
1 files changed, 4 insertions, 9 deletions
diff --git a/src/nvim/fileio.c b/src/nvim/fileio.c index 040df707de..9c64be6d0c 100644 --- a/src/nvim/fileio.c +++ b/src/nvim/fileio.c @@ -1742,16 +1742,11 @@ failed: } # endif - 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) { - (void)fcntl(fd, F_SETFD, fdflags | FD_CLOEXEC); - } + if (!read_buffer && !read_stdin) { + close(fd); // errors are ignored + } else { + (void)os_set_cloexec(fd); } -#endif xfree(buffer); if (read_stdin) { |