diff options
author | b-r-o-c-k <brockmammen@gmail.com> | 2018-03-01 22:56:59 -0600 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-03-01 22:56:59 -0600 |
commit | de3a833ec73cda093df918b8b079df116c42f91c (patch) | |
tree | f9063874a476ca3a09a0321996a92db741ad47d0 /src/nvim/if_cscope.c | |
parent | adfad73d8eb868b7b4691319c1f586f601f6815f (diff) | |
parent | 3d2f4154b1d5d0bb063951c830e009505bdce359 (diff) | |
download | rneovim-de3a833ec73cda093df918b8b079df116c42f91c.tar.gz rneovim-de3a833ec73cda093df918b8b079df116c42f91c.tar.bz2 rneovim-de3a833ec73cda093df918b8b079df116c42f91c.zip |
Merge branch 'master' into msvc-compat
Diffstat (limited to 'src/nvim/if_cscope.c')
-rw-r--r-- | src/nvim/if_cscope.c | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/src/nvim/if_cscope.c b/src/nvim/if_cscope.c index 773e29693c..793142f153 100644 --- a/src/nvim/if_cscope.c +++ b/src/nvim/if_cscope.c @@ -1685,8 +1685,15 @@ static int cs_read_prompt(size_t i) assert(IOSIZE >= cs_emsg_len); size_t maxlen = IOSIZE - cs_emsg_len; - for (;; ) { - while ((ch = getc(csinfo[i].fr_fp)) != EOF && ch != CSCOPE_PROMPT[0]) { + while (1) { + while (1) { + do { + errno = 0; + ch = fgetc(csinfo[i].fr_fp); + } while (ch == EOF && errno == EINTR && ferror(csinfo[i].fr_fp)); + if (ch == EOF || ch == CSCOPE_PROMPT[0]) { + break; + } // if there is room and char is printable if (bufpos < maxlen - 1 && vim_isprintc(ch)) { // lazy buffer allocation @@ -1715,9 +1722,13 @@ static int cs_read_prompt(size_t i) } } - for (size_t n = 0; n < strlen(CSCOPE_PROMPT); ++n) { - if (n > 0) - ch = (char)getc(csinfo[i].fr_fp); + for (size_t n = 0; n < strlen(CSCOPE_PROMPT); n++) { + if (n > 0) { + do { + errno = 0; + ch = fgetc(csinfo[i].fr_fp); + } while (ch == EOF && errno == EINTR && ferror(csinfo[i].fr_fp)); + } if (ch == EOF) { PERROR("cs_read_prompt EOF"); if (buf != NULL && buf[0] != NUL) |