Skip to content

Commit 8316246

Browse files
committed
patch 7.4.1194
Problem: Compiler warning for not using return value of fwrite(). Solution: Return OK/FAIL. (Charles Campbell)
1 parent b8b6511 commit 8316246

File tree

3 files changed

+10
-5
lines changed

3 files changed

+10
-5
lines changed

src/channel.c

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -560,21 +560,22 @@ channel_close(int idx)
560560

561561
/*
562562
* Store "buf[len]" on channel "idx".
563+
* Returns OK or FAIL.
563564
*/
564-
void
565+
int
565566
channel_save(int idx, char_u *buf, int len)
566567
{
567568
queue_T *node;
568569
queue_T *head = &channels[idx].ch_head;
569570

570571
node = (queue_T *)alloc(sizeof(queue_T));
571572
if (node == NULL)
572-
return; /* out of memory */
573+
return FAIL; /* out of memory */
573574
node->buffer = alloc(len + 1);
574575
if (node->buffer == NULL)
575576
{
576577
vim_free(node);
577-
return; /* out of memory */
578+
return FAIL; /* out of memory */
578579
}
579580
mch_memmove(node->buffer, buf, (size_t)len);
580581
node->buffer[len] = NUL;
@@ -594,9 +595,11 @@ channel_save(int idx, char_u *buf, int len)
594595
if (debugfd != NULL)
595596
{
596597
fprintf(debugfd, "RECV on %d: ", idx);
597-
fwrite(buf, len, 1, debugfd);
598+
if (fwrite(buf, len, 1, debugfd) != 1)
599+
return FAIL;
598600
fprintf(debugfd, "\n");
599601
}
602+
return OK;
600603
}
601604

602605
/*

src/proto/channel.pro

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ void channel_will_block(int idx);
88
int channel_decode_json(char_u *msg, typval_T *tv);
99
int channel_is_open(int idx);
1010
void channel_close(int idx);
11-
void channel_save(int idx, char_u *buf, int len);
11+
int channel_save(int idx, char_u *buf, int len);
1212
char_u *channel_peek(int idx);
1313
char_u *channel_get(int idx);
1414
int channel_collapse(int idx);

src/version.c

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

747747
static int included_patches[] =
748748
{ /* Add new patch number below this line */
749+
/**/
750+
1194,
749751
/**/
750752
1193,
751753
/**/

0 commit comments

Comments
 (0)