0
0
mirror of https://github.com/vim/vim.git synced 2025-09-25 03:54:15 -04:00

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 #2081)
This commit is contained in:
Bram Moolenaar
2017-09-13 22:18:01 +02:00
parent 072412ed45
commit 71eeb74a60
2 changed files with 7 additions and 6 deletions

View File

@@ -138,7 +138,7 @@ ch_log_active(void)
} }
static void static void
ch_log_lead(char *what, channel_T *ch) ch_log_lead(const char *what, channel_T *ch)
{ {
if (log_fd != NULL) if (log_fd != NULL)
{ {
@@ -1813,12 +1813,11 @@ channel_save(channel_T *channel, ch_part_T part, char_u *buf, int len,
head->rq_prev = node; head->rq_prev = node;
} }
if (log_fd != NULL && lead != NULL) if (ch_log_active() && lead != NULL)
{ {
ch_log_lead(lead, channel); ch_log_lead(lead, channel);
fprintf(log_fd, "'"); fprintf(log_fd, "'");
if (fwrite(buf, len, 1, log_fd) != 1) ignored = (int)fwrite(buf, len, 1, log_fd);
return FAIL;
fprintf(log_fd, "'\n"); fprintf(log_fd, "'\n");
} }
return OK; return OK;
@@ -3385,7 +3384,7 @@ channel_read_block(channel_T *channel, ch_part_T part, int timeout)
channel_consume(channel, part, (int)(nl - buf) + 1); 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)); ch_log(channel, "Returning %d bytes", (int)STRLEN(msg));
return msg; return msg;
} }
@@ -3670,7 +3669,7 @@ channel_send(
return FAIL; return FAIL;
} }
if (log_fd != NULL) if (ch_log_active())
{ {
ch_log_lead("SEND ", channel); ch_log_lead("SEND ", channel);
fprintf(log_fd, "'"); fprintf(log_fd, "'");

View File

@@ -769,6 +769,8 @@ static char *(features[]) =
static int included_patches[] = static int included_patches[] =
{ /* Add new patch number below this line */ { /* Add new patch number below this line */
/**/
1101,
/**/ /**/
1100, 1100,
/**/ /**/