From: "cron2 (Code Review)" Date: Wed, 24 Sep 2025 14:58:01 +0000 In-Reply-To: References: Reply-To: gert@...1296..., arne-openvpn@...1227..., openvpn-devel@lists.sourceforge.net, frank@...2641... Message-ID: <4714245336b14774b4e3e1ccfbb5c779818500cb-HTML@...2715...> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Disposition: inline Content-Type: multipart/alternative; boundary="TkGVsgChGp4="; 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 Cc: plaisthos , openvpn-devel --TkGVsgChGp4= Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable cron2 has submitted this change. ( http://gerrit.openvpn.net/c/openvpn/+/11= 94?usp=3Demail ) 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(-) 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: merged --TkGVsgChGp4= Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable

cron2 submitted this change.

View Change

ps: Fix conversion warnings related to send/r=
ecv return values

We know that these values can't be big since t= hey are limited
to the size of the input buffer. So we can explicitly ca= st
them to int if required.

Change-Id: Id070d1a45d45f9029309d23df= 7f3cab9ce792205
Signed-off-by: Frank Lichtenheld <frank@...2641...>= ;
Acked-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/me= ssage/59237926/
Signed-off-by: Gert Doering <gert@...1296...>
-= --
M src/openvpn/ps.c
1 file changed, 9 insertions(+), 18 deletions(-= )

diff --git a/src/openvpn/ps.c b/src/openvpn/ps.c
index 1= d14367..31e7c25 100644
--- a/src/openvpn/ps.c
+++ b/src/openvpn/ps.c
@@ -475,11 +475,6 @@
return true;
}

-#if defined(__GNUC__) || defined(__cla= ng__)
-#pragma GCC diag= nostic push
-#pragma GC= C diagnostic ignored "-Wconversion"
-#endif
-
/*
* This function runs in the= context of the background proxy process.
* Receive a con= trol message from the parent (sent by the port_share_sendmsg
@@ -539,7 +534,7 @@

if (st= atus >=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, &am= p;buf, journal_dir))
{
= CLEAR(buf); /* we gave the buffer to proxy_entry_new */
@@ -566,7 +561,7 @@
proxy_connection_io_rec= v(struct proxy_connection *pc)
{
/* r= ecv 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 E= AGAIN) ? IOSTAT_EAGAIN_ON_READ : IOSTAT_READ_ERROR;
@@ -577= ,8 +572,8 @@
{
return= IOSTAT_READ_ERROR;
}
- dmsg(D_PS_PROXY_DEBUG, "PORT SHARE PR= OXY: read[%d] %d", (int)pc->sd, status);
- pc->buf.len =3D status;
+ dmsg(D_PS_PROXY_DEBUG, &q= uot;PORT SHARE PROXY: read[%d] %zd", (int)pc->sd, status);
+ pc->buf.len =3D (= int)status;
}
return IOSTAT_GOOD;=
}
@@ -587,7 +582,7 @@
pr= oxy_connection_io_send(struct proxy_connection *pc, int *bytes_sent)=
{
const socket_descriptor_t sd =3D pc->c= ounterpart->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 (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 writ= e[%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, status);<= /span>
+ buf_adva= nce(&pc->buf, (int)status);
return IOST= AT_EAGAIN_ON_WRITE;
}
els= e
{
- 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 d= efined(__GNUC__) || defined(__clang__)
-#pragma GCC diagnostic pop
-#endif
-
/*
* Called from the main OpenVP= N process to enable the port
* share proxy.

To view, visit change 1194. To unsubscribe, or for 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: merged
--TkGVsgChGp4=--