]> granicus.if.org Git - vim/commitdiff
patch 8.0.1101: channel write fails if writing to log fails v8.0.1101
authorBram Moolenaar <Bram@vim.org>
Wed, 13 Sep 2017 20:18:01 +0000 (22:18 +0200)
committerBram Moolenaar <Bram@vim.org>
Wed, 13 Sep 2017 20:18:01 +0000 (22:18 +0200)
Problem:    Channel write fails if writing to log fails.
Solution:   Ignore return value of fwrite(). (Ozaki Kiichi, closes #2081)

src/channel.c
src/version.c

index fa1898db9c6da4a990a2944708aec6feca8df36c..49bab16d116a7135c67bb53f6f90efdcde3585e0 100644 (file)
@@ -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_T part, char_u *buf, int len,
        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, ch_part_T part, int timeout)
            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, "'");
index a62d1901c438ebe6bab06ce7e9dae6a8061c7b17..259b576ec075d1858325adf9d8b56fe1fcc383d7 100644 (file)
@@ -769,6 +769,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    1101,
 /**/
     1100,
 /**/