]> git.ipfire.org Git - thirdparty/openvpn.git/commitdiff
socket: Change return types of link_socket_write* to ssize_t
authorFrank Lichtenheld <frank@lichtenheld.com>
Wed, 18 Sep 2024 20:48:44 +0000 (22:48 +0200)
committerGert Doering <gert@greenie.muc.de>
Wed, 18 Sep 2024 21:01:24 +0000 (23:01 +0200)
This is the actual return value of send/sendto/sendmsg.
We will leave it to the single caller of link_socket_write()
to decide how to map that to the int buffer world. For now
just cast it explicitly.

Change-Id: I7852c06d331326c1dbab7b642254c0c00d4cebb8
Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com>
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <20240918204844.2820-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg29323.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
src/openvpn/forward.c
src/openvpn/socket.c
src/openvpn/socket.h

index 374ba47b5900ae4573ae4f0814fb453ba849eaf2..8c024079143d06de9dd95bc65569483967210b88 100644 (file)
@@ -1792,7 +1792,7 @@ process_outgoing_link(struct context *c)
                 socks_preprocess_outgoing_link(c, &to_addr, &size_delta);
 
                 /* Send packet */
-                size = link_socket_write(c->c2.link_socket, &c->c2.to_link, to_addr);
+                size = (int)link_socket_write(c->c2.link_socket, &c->c2.to_link, to_addr);
 
                 /* Undo effect of prepend */
                 link_socket_write_post_size_adjust(&size, size_delta, &c->c2.to_link);
index 17c5e769543144f8d37f14d4882e7b78eddcb693..6c790a0c458083c220b41dae34774e8e6cd9fe48 100644 (file)
@@ -3399,7 +3399,7 @@ link_socket_read_udp_posix(struct link_socket *sock,
  * Socket Write Routines
  */
 
-int
+ssize_t
 link_socket_write_tcp(struct link_socket *sock,
                       struct buffer *buf,
                       struct link_socket_actual *to)
@@ -3418,7 +3418,7 @@ link_socket_write_tcp(struct link_socket *sock,
 
 #if ENABLE_IP_PKTINFO
 
-size_t
+ssize_t
 link_socket_write_udp_posix_sendmsg(struct link_socket *sock,
                                     struct buffer *buf,
                                     struct link_socket_actual *to)
index 47083ad3c1d35409af68322dcc89a7fa1a18a292..bbdabfb1354bf2f53726ed21a9ee59f6efd1f949 100644 (file)
@@ -1099,9 +1099,9 @@ link_socket_read(struct link_socket *sock,
  * Socket Write routines
  */
 
-int link_socket_write_tcp(struct link_socket *sock,
-                          struct buffer *buf,
-                          struct link_socket_actual *to);
+ssize_t link_socket_write_tcp(struct link_socket *sock,
+                              struct buffer *buf,
+                              struct link_socket_actual *to);
 
 #ifdef _WIN32
 
@@ -1135,12 +1135,12 @@ link_socket_write_win32(struct link_socket *sock,
 
 #else  /* ifdef _WIN32 */
 
-size_t link_socket_write_udp_posix_sendmsg(struct link_socket *sock,
-                                           struct buffer *buf,
-                                           struct link_socket_actual *to);
+ssize_t link_socket_write_udp_posix_sendmsg(struct link_socket *sock,
+                                            struct buffer *buf,
+                                            struct link_socket_actual *to);
 
 
-static inline size_t
+static inline ssize_t
 link_socket_write_udp_posix(struct link_socket *sock,
                             struct buffer *buf,
                             struct link_socket_actual *to)
@@ -1158,7 +1158,7 @@ link_socket_write_udp_posix(struct link_socket *sock,
                   (socklen_t) af_addr_size(to->dest.addr.sa.sa_family));
 }
 
-static inline size_t
+static inline ssize_t
 link_socket_write_tcp_posix(struct link_socket *sock,
                             struct buffer *buf,
                             struct link_socket_actual *to)
@@ -1168,7 +1168,7 @@ link_socket_write_tcp_posix(struct link_socket *sock,
 
 #endif /* ifdef _WIN32 */
 
-static inline size_t
+static inline ssize_t
 link_socket_write_udp(struct link_socket *sock,
                       struct buffer *buf,
                       struct link_socket_actual *to)
@@ -1181,7 +1181,7 @@ link_socket_write_udp(struct link_socket *sock,
 }
 
 /* write a TCP or UDP packet to link */
-static inline int
+static inline ssize_t
 link_socket_write(struct link_socket *sock,
                   struct buffer *buf,
                   struct link_socket_actual *to)