Skip to contentSkip to conversation

Fix types in WIN32 socket_listen_accept()

PATCH In review Steffan Karger 3 participants 3 messages Mar 9, 2017 – Mar 12, 2017

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Fix types in WIN32 socket_listen_accept()

SOCKET_UNDEFINED is of type socket_descriptor_t (or SOCKET, in MS types), so new_sd should be too. Also, the return value of this function is always stored in a socket_descriptor_t variable, so it should return that type (which makes sense now, because it returns new_sd) instead of an int.

---
 src/openvpn/socket.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
src/openvpn/socket.c +2 -2
index 6aa2e6d..672634a 100644
@@ -1146,7 +1146,7 @@ tcp_connection_established(const struct link_socket_actual *act)
     gc_free(&gc);
 }
 
-static int
+static socket_descriptor_t
 socket_listen_accept(socket_descriptor_t sd,
                      struct link_socket_actual *act,
                      const char *remote_dynamic,
@@ -1158,7 +1158,7 @@ socket_listen_accept(socket_descriptor_t sd,
     struct gc_arena gc = gc_new();
     /* struct openvpn_sockaddr *remote = &act->dest; */
     struct openvpn_sockaddr remote_verify = act->dest;
-    int new_sd = SOCKET_UNDEFINED;
+    socket_descriptor_t new_sd = SOCKET_UNDEFINED;
 
     CLEAR(*act);
     socket_do_listen(sd, local, do_listen, true);
Signature · 1 line
2.7.4
#1 lore raw

Am 09.03.17 um 11:47 schrieb Steffan Karger:

Quoted 6 lines

SOCKET_UNDEFINED is of type socket_descriptor_t (or SOCKET, in MS types), so new_sd should be too. Also, the return value of this function is always stored in a socket_descriptor_t variable, so it should return that type (which makes sense now, because it returns new_sd) instead of an int.

ACK.

Arne

#2 lore raw
In reply to Steffan Karger

Your patch has been applied to the master and release/2.4 branch (bugfix).

commit 33e1a869fc6edb6bce5816b11dbecfaca57b20d4 (master) commit 8be20c210e3907209af08ede9f23d62b83665bd1 (release/2.4)

Author: Steffan Karger
Date:   Thu Mar 9 11:47:35 2017 +0100
     Fix types in WIN32 socket_listen_accept()

     Signed-off-by: Steffan Karger <[email protected]...>
     Acked-by: Arne Schwabe <[email protected]...>
     Message-Id: <[email protected]...>
     URL: https://www.mail-archive.com/[email protected]/msg14239.html
     Signed-off-by: Gert Doering <[email protected]...>

--
kind regards,

Gert Doering