Navigation Menu

Skip to content

Commit

Permalink
Handle the return value of write to suppress a warning
Browse files Browse the repository at this point in the history
This change suppresses the following warning (gcc):
  groonga.c: In function ‘send_ready_notify’:
  groonga.c:806:5: warning: ignoring return value of ‘write’, declared with attribute warn_unused_result [-Wunused-result]
       write(ready_notify_pipe[PIPE_WRITE],
       ^
  • Loading branch information
s-yata committed Feb 9, 2018
1 parent fec6cc6 commit 91d02ab
Showing 1 changed file with 15 additions and 4 deletions.
19 changes: 15 additions & 4 deletions src/groonga.c
Expand Up @@ -797,16 +797,27 @@ close_ready_notify_pipe(void)
reset_ready_notify_pipe();
}

static void
/* FIXME: callers ignore the return value of send_ready_notify. */
static grn_bool
send_ready_notify(void)
{
if (ready_notify_pipe[PIPE_WRITE] > 0) {
const char *ready_notify_message = "ready";
write(ready_notify_pipe[PIPE_WRITE],
ready_notify_message,
strlen(ready_notify_message));
const size_t ready_notify_message_len = strlen(ready_notify_message);
size_t n = 0;
do {
ssize_t m = write(ready_notify_pipe[PIPE_WRITE],
ready_notify_message + n,
ready_notify_message_len - n);
if (m == -1) {
close_ready_notify_pipe();
return GRN_FALSE;
}
n += m;
} while (n < ready_notify_message_len);
}
close_ready_notify_pipe();
return GRN_TRUE;
}

static void
Expand Down

0 comments on commit 91d02ab

Please sign in to comment.