Skip to content

Commit

Permalink
Merge pull request #36 from jean-edouard/stable-6-nosignal
Browse files Browse the repository at this point in the history
STABLE-6: libdmbus: avoid sigpipe when the destination is closed
  • Loading branch information
rossphilipson authored Aug 1, 2016
2 parents 8ee76ea + 7ab4da1 commit 12893b2
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion libdmbus/src/dmbus.c.in
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,7 @@ void dmbus_client_disconnect(dmbus_client_t client)
free(c);
}

/* TODO: if v4v_send fails, we may want to tell the caller... */
static void send_msg(struct dmbus_client *c,
int msgtype,
void *data,
Expand All @@ -258,7 +259,11 @@ static void send_msg(struct dmbus_client *c,
hdr->msg_len = len;

while (b < len) {
rc = v4v_send(c->fd, data + b, len - b, 0);
/*
* Let's not let v4v_send crash the program:
* Use MSG_NOSIGNAL to avoid the SIGPIPE.
*/
rc = v4v_send(c->fd, data + b, len - b, MSG_NOSIGNAL);
if (rc == -1)
return;

Expand Down

0 comments on commit 12893b2

Please sign in to comment.