]> granicus.if.org Git - vim/commitdiff
patch 7.4.1194 v7.4.1194
authorBram Moolenaar <Bram@vim.org>
Thu, 28 Jan 2016 22:10:07 +0000 (23:10 +0100)
committerBram Moolenaar <Bram@vim.org>
Thu, 28 Jan 2016 22:10:07 +0000 (23:10 +0100)
Problem:    Compiler warning for not using return value of fwrite().
Solution:   Return OK/FAIL. (Charles Campbell)

src/channel.c
src/proto/channel.pro
src/version.c

index c18f25e2634721198c2374e9a058ad95e9f00be4..def6833136a6192cd2b652894be5a7d543793202 100644 (file)
@@ -560,8 +560,9 @@ channel_close(int idx)
 
 /*
  * Store "buf[len]" on channel "idx".
+ * Returns OK or FAIL.
  */
-    void
+    int
 channel_save(int idx, char_u *buf, int len)
 {
     queue_T *node;
@@ -569,12 +570,12 @@ channel_save(int idx, char_u *buf, int len)
 
     node = (queue_T *)alloc(sizeof(queue_T));
     if (node == NULL)
-       return;     /* out of memory */
+       return FAIL;        /* out of memory */
     node->buffer = alloc(len + 1);
     if (node->buffer == NULL)
     {
        vim_free(node);
-       return;     /* out of memory */
+       return FAIL;        /* out of memory */
     }
     mch_memmove(node->buffer, buf, (size_t)len);
     node->buffer[len] = NUL;
@@ -594,9 +595,11 @@ channel_save(int idx, char_u *buf, int len)
     if (debugfd != NULL)
     {
        fprintf(debugfd, "RECV on %d: ", idx);
-       fwrite(buf, len, 1, debugfd);
+       if (fwrite(buf, len, 1, debugfd) != 1)
+           return FAIL;
        fprintf(debugfd, "\n");
     }
+    return OK;
 }
 
 /*
index 110bb1da31a96cc143f324088dd98001bd2f2cba..2d46a4963fa90924126619677f9219b6cac83c28 100644 (file)
@@ -8,7 +8,7 @@ void channel_will_block(int idx);
 int channel_decode_json(char_u *msg, typval_T *tv);
 int channel_is_open(int idx);
 void channel_close(int idx);
-void channel_save(int idx, char_u *buf, int len);
+int channel_save(int idx, char_u *buf, int len);
 char_u *channel_peek(int idx);
 char_u *channel_get(int idx);
 int channel_collapse(int idx);
index 98c499a925a1aeb9cb386206b44d9ecd9dbb52d2..c246ed4bcba8c4287adb78f8a4a2e3202724b856 100644 (file)
@@ -746,6 +746,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    1194,
 /**/
     1193,
 /**/