diff options
author | Björn Linse <bjorn.linse@gmail.com> | 2017-09-06 08:16:59 +0200 |
---|---|---|
committer | Björn Linse <bjorn.linse@gmail.com> | 2017-11-25 09:37:00 +0100 |
commit | 85bc6630c0a8259c713383c8787e65f92e24e600 (patch) | |
tree | 9ee249d6ecff439c1e35d56267b3598343a4fe54 /src | |
parent | 9acd7bfe25b5ea2b31ffbbdbd201f5f09afc4237 (diff) | |
download | rneovim-85bc6630c0a8259c713383c8787e65f92e24e600.tar.gz rneovim-85bc6630c0a8259c713383c8787e65f92e24e600.tar.bz2 rneovim-85bc6630c0a8259c713383c8787e65f92e24e600.zip |
input: only change mode of input fd if there is an input fd
Diffstat (limited to 'src')
-rw-r--r-- | src/nvim/if_cscope.c | 1 | ||||
-rw-r--r-- | src/nvim/misc1.c | 5 | ||||
-rw-r--r-- | src/nvim/os/input.c | 2 | ||||
-rw-r--r-- | src/nvim/os_unix.c | 4 |
4 files changed, 8 insertions, 4 deletions
diff --git a/src/nvim/if_cscope.c b/src/nvim/if_cscope.c index 0f9ecdf2d7..6834e7a802 100644 --- a/src/nvim/if_cscope.c +++ b/src/nvim/if_cscope.c @@ -778,7 +778,6 @@ err_closing: if (execl("/bin/sh", "sh", "-c", cmd, (char *)NULL) == -1) PERROR(_("cs_create_connection exec failed")); - stream_set_blocking(input_global_fd(), true); // normalize stream (#2598) exit(127); /* NOTREACHED */ default: /* parent. */ diff --git a/src/nvim/misc1.c b/src/nvim/misc1.c index 137de84953..f7ee2950ef 100644 --- a/src/nvim/misc1.c +++ b/src/nvim/misc1.c @@ -2622,7 +2622,10 @@ void preserve_exit(void) // Prevent repeated calls into this method. if (really_exiting) { - stream_set_blocking(input_global_fd(), true); //normalize stream (#2598) + if (input_global_fd() >= 0) { + // normalize stream (#2598) + stream_set_blocking(input_global_fd(), true); + } exit(2); } diff --git a/src/nvim/os/input.c b/src/nvim/os/input.c index 31e06ce404..7d6f2abd7f 100644 --- a/src/nvim/os/input.c +++ b/src/nvim/os/input.c @@ -37,7 +37,7 @@ typedef enum { static Stream read_stream = {.closed = true}; static RBuffer *input_buffer = NULL; static bool input_eof = false; -static int global_fd = 0; +static int global_fd = -1; static int events_enabled = 0; static bool blocking = false; diff --git a/src/nvim/os_unix.c b/src/nvim/os_unix.c index 692bcc97f4..d7ba675b68 100644 --- a/src/nvim/os_unix.c +++ b/src/nvim/os_unix.c @@ -144,7 +144,9 @@ void mch_exit(int r) FUNC_ATTR_NORETURN if (!event_teardown() && r == 0) { r = 1; // Exit with error if main_loop did not teardown gracefully. } - stream_set_blocking(input_global_fd(), true); // normalize stream (#2598) + if (input_global_fd() >= 0) { + stream_set_blocking(input_global_fd(), true); // normalize stream (#2598) + } #ifdef EXITFREE free_all_mem(); |