Mercurial > vim
changeset 12443:579faede5d9c v8.0.1101
patch 8.0.1101: channel write fails if writing to log fails
commit https://github.com/vim/vim/commit/71eeb74a608ddae2b52fb43766616672d0cdda18
Author: Bram Moolenaar <Bram@vim.org>
Date: Wed Sep 13 22:18:01 2017 +0200
patch 8.0.1101: channel write fails if writing to log fails
Problem: Channel write fails if writing to log fails.
Solution: Ignore return value of fwrite(). (Ozaki Kiichi, closes https://github.com/vim/vim/issues/2081)
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Wed, 13 Sep 2017 22:30:05 +0200 |
parents | 3ba53234ccf3 |
children | 308ef06578bc |
files | src/channel.c src/version.c |
diffstat | 2 files changed, 7 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/src/channel.c +++ b/src/channel.c @@ -138,7 +138,7 @@ ch_log_active(void) } static void -ch_log_lead(char *what, channel_T *ch) +ch_log_lead(const char *what, channel_T *ch) { if (log_fd != NULL) { @@ -1813,12 +1813,11 @@ channel_save(channel_T *channel, ch_part head->rq_prev = node; } - if (log_fd != NULL && lead != NULL) + if (ch_log_active() && lead != NULL) { ch_log_lead(lead, channel); fprintf(log_fd, "'"); - if (fwrite(buf, len, 1, log_fd) != 1) - return FAIL; + ignored = (int)fwrite(buf, len, 1, log_fd); fprintf(log_fd, "'\n"); } return OK; @@ -3385,7 +3384,7 @@ channel_read_block(channel_T *channel, c channel_consume(channel, part, (int)(nl - buf) + 1); } } - if (log_fd != NULL) + if (ch_log_active()) ch_log(channel, "Returning %d bytes", (int)STRLEN(msg)); return msg; } @@ -3670,7 +3669,7 @@ channel_send( return FAIL; } - if (log_fd != NULL) + if (ch_log_active()) { ch_log_lead("SEND ", channel); fprintf(log_fd, "'");