From: "cron2 (Code Review)" Date: Wed, 24 Sep 2025 14:57:58 +0000 In-Reply-To: References: Reply-To: gert@...1296..., arne-openvpn@...1227..., openvpn-devel@lists.sourceforge.net, frank@...2641... Message-ID: <4714245336b14774b4e3e1ccfbb5c779818500cb-EmailReplacePatchSet-HTML@...2715...> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Disposition: inline Content-Type: multipart/alternative; boundary="H3d46lcw0ts="; charset=UTF-8 Subject: [Openvpn-devel] [S] Change in openvpn[master]: ps: Fix conversion warnings related to send/recv return values List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: flichtenheld , plaisthos Cc: openvpn-devel --H3d46lcw0ts= Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable cron2 has uploaded a new patch set (#8) to the change originally created by= flichtenheld. ( http://gerrit.openvpn.net/c/openvpn/+/1194?usp=3Demail ) The following approvals got outdated and were removed: Code-Review+2 by cron2 Change subject: ps: Fix conversion warnings related to send/recv return val= ues ...................................................................... ps: Fix conversion warnings related to send/recv return values We know that these values can't be big since they are limited to the size of the input buffer. So we can explicitly cast them to int if required. Change-Id: Id070d1a45d45f9029309d23df7f3cab9ce792205 Signed-off-by: Frank Lichtenheld Acked-by: Gert Doering Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1194 Message-Id: <20250924082121.23139-1-gert@...1296...> URL: https://sourceforge.net/p/openvpn/mailman/message/59237926/ Signed-off-by: Gert Doering --- M src/openvpn/ps.c 1 file changed, 9 insertions(+), 18 deletions(-) git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/94/1194/8 diff --git a/src/openvpn/ps.c b/src/openvpn/ps.c index 1d14367..31e7c25 100644 --- a/src/openvpn/ps.c +++ b/src/openvpn/ps.c @@ -475,11 +475,6 @@ return true; } -#if defined(__GNUC__) || defined(__clang__) -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wconversion" -#endif - /* * This function runs in the context of the background proxy process. * Receive a control message from the parent (sent by the port_share_sendm= sg @@ -539,7 +534,7 @@ if (status >=3D 2 && command =3D=3D COMMAND_REDIRECT) { - buf.len =3D status - 1; + buf.len =3D (int)status - 1; if (proxy_entry_new(list, es, server_addr, received_fd, &b= uf, journal_dir)) { CLEAR(buf); /* we gave the buffer to proxy_entry_new */ @@ -566,7 +561,7 @@ proxy_connection_io_recv(struct proxy_connection *pc) { /* recv data from socket */ - const int status =3D recv(pc->sd, BPTR(&pc->buf), BCAP(&pc->buf), MSG_= NOSIGNAL); + const ssize_t status =3D recv(pc->sd, BPTR(&pc->buf), BCAP(&pc->buf), = MSG_NOSIGNAL); if (status < 0) { return (errno =3D=3D EAGAIN) ? IOSTAT_EAGAIN_ON_READ : IOSTAT_READ= _ERROR; @@ -577,8 +572,8 @@ { return IOSTAT_READ_ERROR; } - dmsg(D_PS_PROXY_DEBUG, "PORT SHARE PROXY: read[%d] %d", (int)pc->s= d, status); - pc->buf.len =3D status; + dmsg(D_PS_PROXY_DEBUG, "PORT SHARE PROXY: read[%d] %zd", (int)pc->= sd, status); + pc->buf.len =3D (int)status; } return IOSTAT_GOOD; } @@ -587,7 +582,7 @@ proxy_connection_io_send(struct proxy_connection *pc, int *bytes_sent) { const socket_descriptor_t sd =3D pc->counterpart->sd; - const int status =3D send(sd, BPTR(&pc->buf), BLEN(&pc->buf), MSG_NOSI= GNAL); + const ssize_t status =3D send(sd, BPTR(&pc->buf), BLEN(&pc->buf), MSG_= NOSIGNAL); if (status < 0) { @@ -596,17 +591,17 @@ } else { - *bytes_sent +=3D status; + *bytes_sent +=3D (int)status; if (status !=3D pc->buf.len) { - dmsg(D_PS_PROXY_DEBUG, "PORT SHARE PROXY: partial write[%d], t= ried=3D%d got=3D%d", (int)sd, + dmsg(D_PS_PROXY_DEBUG, "PORT SHARE PROXY: partial write[%d], t= ried=3D%d got=3D%zd", (int)sd, pc->buf.len, status); - buf_advance(&pc->buf, status); + buf_advance(&pc->buf, (int)status); return IOSTAT_EAGAIN_ON_WRITE; } else { - dmsg(D_PS_PROXY_DEBUG, "PORT SHARE PROXY: wrote[%d] %d", (int)= sd, status); + dmsg(D_PS_PROXY_DEBUG, "PORT SHARE PROXY: wrote[%d] %zd", (int= )sd, status); pc->buf.len =3D 0; pc->buf.offset =3D 0; } @@ -797,10 +792,6 @@ msg(M_INFO, "PORT SHARE PROXY: proxy exiting"); } -#if defined(__GNUC__) || defined(__clang__) -#pragma GCC diagnostic pop -#endif - /* * Called from the main OpenVPN process to enable the port * share proxy. -- To view, visit http://gerrit.openvpn.net/c/openvpn/+/1194?usp=3Demail To unsubscribe, or for help writing mail filters, visit http://gerrit.openv= pn.net/settings Gerrit-Project: openvpn Gerrit-Branch: master Gerrit-Change-Id: Id070d1a45d45f9029309d23df7f3cab9ce792205 Gerrit-Change-Number: 1194 Gerrit-PatchSet: 8 Gerrit-Owner: flichtenheld Gerrit-Reviewer: cron2 Gerrit-Reviewer: flichtenheld Gerrit-Reviewer: plaisthos Gerrit-CC: openvpn-devel Gerrit-MessageType: newpatchset --H3d46lcw0ts= Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable

cron2 uploaded patch set #8 to the change originally cr= eated by flichtenheld.

View Change

The following approvals got outd= ated and were removed: Code-Review+2 by cron2

ps: Fix conversion warnings related to send/recv ret=
urn values

We know that these values can't be big since they are= limited
to the size of the input buffer. So we can explicitly cast
t= hem to int if required.

Change-Id: Id070d1a45d45f9029309d23df7f3cab9= ce792205
Signed-off-by: Frank Lichtenheld <frank@...2641...>
Ac= ked-by: Gert Doering <gert@...1296...>
Gerrit URL: https://gerrit.= openvpn.net/c/openvpn/+/1194
Message-Id: <20250924082121.23139-1-gert= @...1296...>
URL: https://sourceforge.net/p/openvpn/mailman/message/5= 9237926/
Signed-off-by: Gert Doering <gert@...1296...>
---
M= src/openvpn/ps.c
1 file changed, 9 insertions(+), 18 deletions(-)
git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/94/1194/8=
diff --git a/src/openvpn/ps.c b/src/openvpn/ps.c
i= ndex 1d14367..31e7c25 100644
--- a/src/openvpn/ps.c<= br>+++ b/src/openvpn/ps.c
@@ -475,11 +475,6 @@=
return true;
}

= -#if defined(__GNUC__) || defined= (__clang__)
-#pragma GC= C diagnostic push
-#pra= gma GCC diagnostic ignored "-Wconversion"
-#endif
-
/*
* This function run= s in the context of the background proxy process.
* Recei= ve a control message from the parent (sent by the port_share_sendmsg=
@@ -539,7 +534,7 @@

= if (status >=3D 2 && command =3D=3D COMMAND_REDIRECT) {
= - buf.len =3D status - 1;
+ buf.len =3D (int)status - 1; if (proxy_entry_new(list, es, server_addr, received= _fd, &buf, journal_dir))
{
<= span> CLEAR(buf); /* we gave the buffer to proxy_entry_= new */
@@ -566,7 +561,7 @@
proxy_connectio= n_io_recv(struct proxy_connection *pc)
{
= /* recv data from socket */
- const int status =3D recv(pc->sd, BPTR(&pc->buf), B= CAP(&pc->buf), MSG_NOSIGNAL);
+ const ssize_t status =3D recv(pc->sd, BPTR(&pc-= >buf), BCAP(&pc->buf), MSG_NOSIGNAL);
if (st= atus < 0)
{
return (errno = =3D=3D EAGAIN) ? IOSTAT_EAGAIN_ON_READ : IOSTAT_READ_ERROR;
@@ -577,8 +572,8 @@
{
= return IOSTAT_READ_ERROR;
}
- dmsg(D_PS_PROXY_DEBUG, "PORT = SHARE PROXY: read[%d] %d", (int)pc->sd, status);
- pc->buf.len =3D status;

+ dmsg(D_PS_PROXY_D= EBUG, "PORT SHARE PROXY: read[%d] %zd", (int)pc->sd, status);<= /span>
+ pc->buf.l= en =3D (int)status;
}
return IOST= AT_GOOD;
}
@@ -587,7 +582,7 @@
<= span> proxy_connection_io_send(struct proxy_connection *pc, int *bytes_sent= )

{
const socket_descriptor_t sd =3D = pc->counterpart->sd;
- const int status =3D send(sd, BPTR(&pc->buf), BLEN(&pc-= >buf), MSG_NOSIGNAL);
+ const ssize_t status =3D send(sd, BPTR(&pc->buf), BLEN(&= ;pc->buf), MSG_NOSIGNAL);

if (sta= tus < 0)
{
@@ -596,17 +591,17 @@
}
else
{
- *bytes_sent +=3D st= atus;
+ *bytes= _sent +=3D (int)status;
if (status !=3D pc->buf= .len)
{
- dmsg(D_PS_PROXY_DEBUG, "PORT SHARE PROXY: parti= al write[%d], tried=3D%d got=3D%d", (int)sd,
+ dmsg(D_PS_PROXY_DEBUG, "PORT= SHARE PROXY: partial write[%d], tried=3D%d got=3D%zd", (int)sd,
pc->buf.len, status);
- buf_advance(&pc->buf, st= atus);
+ b= uf_advance(&pc->buf, (int)status);
retu= rn IOSTAT_EAGAIN_ON_WRITE;
}
= else
{
- dmsg(D_PS_PROXY_DEBUG, "PORT SHARE PROXY: wr= ote[%d] %d", (int)sd, status);
+ dmsg(D_PS_PROXY_DEBUG, "PORT SHARE PROXY: = wrote[%d] %zd", (int)sd, status);
pc->= buf.len =3D 0;
pc->buf.offset =3D 0;=
}
@@ -797,10 +792,6 @@
= msg(M_INFO, "PORT SHARE PROXY: proxy exiting");
}


-#if defined(__GNUC__) || defined(__clang__)
-#pragma GCC diagnostic pop
-#endif
-
/*
* Called from the main= OpenVPN process to enable the port
* share proxy.=

To view, visit change 1194. To unsubscribe, or fo= r help writing mail filters, visit settings.

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Id070d1a45d45f9029309d23df7f= 3cab9ce792205
Gerrit-Change-Number: 1194
Gerrit-PatchSet: 8
Gerrit-Owner: flichtenheld <frank@...2723...= .>
Gerrit-Reviewer: cron2 <gert@...1296...>=
Gerrit-Reviewer: flichtenheld <frank@...2716...= 1...>
Gerrit-Reviewer: plaisthos <arne-openvpn@...1186...= .1227...>
Gerrit-CC: openvpn-devel <openvpn-devel@...1484...= ts.sourceforge.net>
Gerrit-MessageType: newpatchset
--H3d46lcw0ts=--