Commit 2a359eb0181a12d55150cf7a6c4289671206e93a

Authored by Stéphane Raimbault
1 parent f1fcb624

Block SIGPIPE signal

Requests not to send SIGPIPE on errors on stream oriented sockets
when the other end breaks the connection.
Showing 1 changed file with 1 additions and 1 deletions
src/modbus.c
@@ -447,7 +447,7 @@ static int modbus_send(modbus_param_t *mb_param, uint8_t *query, @@ -447,7 +447,7 @@ static int modbus_send(modbus_param_t *mb_param, uint8_t *query,
447 if (mb_param->type_com == RTU) 447 if (mb_param->type_com == RTU)
448 ret = write(mb_param->fd, query, query_length); 448 ret = write(mb_param->fd, query, query_length);
449 else 449 else
450 - ret = send(mb_param->fd, query, query_length, 0); 450 + ret = send(mb_param->fd, query, query_length, MSG_NOSIGNAL);
451 451
452 /* Return the number of bytes written (0 to n) 452 /* Return the number of bytes written (0 to n)
453 or SOCKET_FAILURE on error */ 453 or SOCKET_FAILURE on error */