Skip to content

Commit 71eeb74

Browse files
committed
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)
1 parent 072412e commit 71eeb74

2 files changed

Lines changed: 7 additions & 6 deletions

File tree

src/channel.c

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ ch_log_active(void)
138138
}
139139

140140
static void
141-
ch_log_lead(char *what, channel_T *ch)
141+
ch_log_lead(const char *what, channel_T *ch)
142142
{
143143
if (log_fd != NULL)
144144
{
@@ -1813,12 +1813,11 @@ channel_save(channel_T *channel, ch_part_T part, char_u *buf, int len,
18131813
head->rq_prev = node;
18141814
}
18151815

1816-
if (log_fd != NULL && lead != NULL)
1816+
if (ch_log_active() && lead != NULL)
18171817
{
18181818
ch_log_lead(lead, channel);
18191819
fprintf(log_fd, "'");
1820-
if (fwrite(buf, len, 1, log_fd) != 1)
1821-
return FAIL;
1820+
ignored = (int)fwrite(buf, len, 1, log_fd);
18221821
fprintf(log_fd, "'\n");
18231822
}
18241823
return OK;
@@ -3385,7 +3384,7 @@ channel_read_block(channel_T *channel, ch_part_T part, int timeout)
33853384
channel_consume(channel, part, (int)(nl - buf) + 1);
33863385
}
33873386
}
3388-
if (log_fd != NULL)
3387+
if (ch_log_active())
33893388
ch_log(channel, "Returning %d bytes", (int)STRLEN(msg));
33903389
return msg;
33913390
}
@@ -3670,7 +3669,7 @@ channel_send(
36703669
return FAIL;
36713670
}
36723671

3673-
if (log_fd != NULL)
3672+
if (ch_log_active())
36743673
{
36753674
ch_log_lead("SEND ", channel);
36763675
fprintf(log_fd, "'");

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -769,6 +769,8 @@ static char *(features[]) =
769769

770770
static int included_patches[] =
771771
{ /* Add new patch number below this line */
772+
/**/
773+
1101,
772774
/**/
773775
1100,
774776
/**/

0 commit comments

Comments
 (0)