Преглед на файлове

Block SIGPIPE signal

Requests not to send SIGPIPE on errors on stream oriented sockets
when the other end breaks the connection.
Stéphane Raimbault преди 15 години
родител
ревизия
2a359eb018
променени са 1 файла, в които са добавени 1 реда и са изтрити 1 реда
  1. 1 1
      src/modbus.c

+ 1 - 1
src/modbus.c

@@ -447,7 +447,7 @@ static int modbus_send(modbus_param_t *mb_param, uint8_t *query,
         if (mb_param->type_com == RTU)
         if (mb_param->type_com == RTU)
                 ret = write(mb_param->fd, query, query_length);
                 ret = write(mb_param->fd, query, query_length);
         else
         else
-                ret = send(mb_param->fd, query, query_length, 0);
+                ret = send(mb_param->fd, query, query_length, MSG_NOSIGNAL);
 
 
         /* Return the number of bytes written (0 to n)
         /* Return the number of bytes written (0 to n)
            or SOCKET_FAILURE on error */
            or SOCKET_FAILURE on error */