diff options
author | Justin M. Keyes <justinkz@gmail.com> | 2017-11-26 21:17:35 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-11-26 21:17:35 +0100 |
commit | a043899ba255524b7421579b9bd6112801f09247 (patch) | |
tree | e4dc3cc54e327310ab661de5125ce37313670aa1 /src/nvim/if_cscope.c | |
parent | 207b7ca4bc16d52641eaa5244eef25a0dba91dbc (diff) | |
parent | bab2f8200aea09ad32bbcb2e83404bbd4076a227 (diff) | |
download | rneovim-a043899ba255524b7421579b9bd6112801f09247.tar.gz rneovim-a043899ba255524b7421579b9bd6112801f09247.tar.bz2 rneovim-a043899ba255524b7421579b9bd6112801f09247.zip |
Merge #7633 'Retry fgets on EINTR'
closes #7632
Diffstat (limited to 'src/nvim/if_cscope.c')
-rw-r--r-- | src/nvim/if_cscope.c | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/src/nvim/if_cscope.c b/src/nvim/if_cscope.c index 6834e7a802..3c02f5acbd 100644 --- a/src/nvim/if_cscope.c +++ b/src/nvim/if_cscope.c @@ -553,9 +553,15 @@ static int cs_cnt_matches(size_t idx) char *buf = xmalloc(CSREAD_BUFSIZE); for (;; ) { + errno = 0; if (!fgets(buf, CSREAD_BUFSIZE, csinfo[idx].fr_fp)) { - if (feof(csinfo[idx].fr_fp)) + if (errno == EINTR) { + continue; + } + + if (feof(csinfo[idx].fr_fp)) { errno = EIO; + } cs_reading_emsg(idx); @@ -1380,9 +1386,16 @@ static char *cs_parse_results(size_t cnumber, char *buf, int bufsize, char *p; char *name; +retry: + errno = 0; if (fgets(buf, bufsize, csinfo[cnumber].fr_fp) == NULL) { - if (feof(csinfo[cnumber].fr_fp)) + if (errno == EINTR) { + goto retry; + } + + if (feof(csinfo[cnumber].fr_fp)) { errno = EIO; + } cs_reading_emsg(cnumber); |