summarylogtreecommitdiffstats
path: root/dde16d5.diff
blob: f1edbefa4107d05d0aff0fb04c418582a669fc36 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
diff --git a/src/modbus-tcp.c b/src/modbus-tcp.c
index 67ee84a7..31bbfcaf 100644
--- a/src/modbus-tcp.c
+++ b/src/modbus-tcp.c
@@ -230,7 +230,7 @@ static int _modbus_tcp_set_ipv4_options(int s)
     /* Set the TCP no delay flag */
     /* SOL_TCP = IPPROTO_TCP */
     option = 1;
-    rc = setsockopt(s, IPPROTO_TCP, TCP_NODELAY, (const void *) &option, sizeof(int));
+    rc = setsockopt(s, IPPROTO_TCP, TCP_NODELAY, &option, sizeof(int));
     if (rc == -1) {
         return -1;
     }
@@ -258,7 +258,7 @@ static int _modbus_tcp_set_ipv4_options(int s)
      **/
     /* Set the IP low delay option */
     option = IPTOS_LOWDELAY;
-    rc = setsockopt(s, IPPROTO_IP, IP_TOS, (const void *) &option, sizeof(int));
+    rc = setsockopt(s, IPPROTO_IP, IP_TOS, &option, sizeof(int));
     if (rc == -1) {
         return -1;
     }
@@ -547,8 +547,7 @@ int modbus_tcp_listen(modbus_t *ctx, int nb_connection)
     }
 
     enable = 1;
-    if (setsockopt(new_s, SOL_SOCKET, SO_REUSEADDR, (char *) &enable, sizeof(enable)) ==
-        -1) {
+    if (setsockopt(new_s, SOL_SOCKET, SO_REUSEADDR, &enable, sizeof(enable)) == -1) {
         close(new_s);
         return -1;
     }
@@ -665,8 +664,7 @@ int modbus_tcp_pi_listen(modbus_t *ctx, int nb_connection)
             continue;
         } else {
             int enable = 1;
-            rc =
-                setsockopt(s, SOL_SOCKET, SO_REUSEADDR, (void *) &enable, sizeof(enable));
+            rc = setsockopt(s, SOL_SOCKET, SO_REUSEADDR, &enable, sizeof(enable));
             if (rc != 0) {
                 close(s);
                 if (ctx->debug) {