diff options
author | Justin M. Keyes <justinkz@gmail.com> | 2016-05-28 12:53:31 -0400 |
---|---|---|
committer | Justin M. Keyes <justinkz@gmail.com> | 2016-05-28 12:57:22 -0400 |
commit | 8c127c77a6f3c9d3c82f5cff23650efcfb8ca26e (patch) | |
tree | 70057daab1ee0635e46b6eb9a3d42ec1c1a4aff5 | |
parent | fe0c3999ca484e991badcde34a5ad962d72440f3 (diff) | |
download | rneovim-8c127c77a6f3c9d3c82f5cff23650efcfb8ca26e.tar.gz rneovim-8c127c77a6f3c9d3c82f5cff23650efcfb8ca26e.tar.bz2 rneovim-8c127c77a6f3c9d3c82f5cff23650efcfb8ca26e.zip |
fopen_noinh_readbin: restore WIN32 decision
-rw-r--r-- | src/nvim/ex_cmds2.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/nvim/ex_cmds2.c b/src/nvim/ex_cmds2.c index 5fc64596a9..d167c28182 100644 --- a/src/nvim/ex_cmds2.c +++ b/src/nvim/ex_cmds2.c @@ -2481,24 +2481,28 @@ int source_level(void *cookie) return ((struct source_cookie *)cookie)->level; } - /// Special function to open a file without handle inheritance. /// If possible the handle is closed on exec(). static FILE *fopen_noinh_readbin(char *filename) { +#ifdef WIN32 + int fd_tmp = os_open(filename, O_RDONLY | O_BINARY | O_NOINHERIT, 0); +#else int fd_tmp = os_open(filename, O_RDONLY, 0); +#endif - if (fd_tmp < 0) + if (fd_tmp < 0) { return NULL; + } -# ifdef HAVE_FD_CLOEXEC +#ifdef HAVE_FD_CLOEXEC { int fdflags = fcntl(fd_tmp, F_GETFD); if (fdflags >= 0 && (fdflags & FD_CLOEXEC) == 0) { (void)fcntl(fd_tmp, F_SETFD, fdflags | FD_CLOEXEC); } } -# endif +#endif return fdopen(fd_tmp, READBIN); } |