From: "cron2 (Code Review)" Date: Sun, 14 Sep 2025 17:26:14 +0000 In-Reply-To: References: Reply-To: gert@...1296..., arne-openvpn@...1227..., openvpn-devel@lists.sourceforge.net, frank@...2641... Message-ID: <5cfb469ee307a6085573e6047a16c09abb4b2129-EmailReplacePatchSet-HTML@...2715...> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Disposition: inline Content-Type: multipart/alternative; boundary="yZCtXPsP/mw="; charset=UTF-8 Subject: [Openvpn-devel] [S] Change in openvpn[master]: ps: Clean up conversion warnings in journal_add function List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: flichtenheld , plaisthos Cc: openvpn-devel --yZCtXPsP/mw= Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable cron2 has uploaded a new patch set (#2) to the change originally created by= flichtenheld. ( http://gerrit.openvpn.net/c/openvpn/+/1163?usp=3Demail ) The following approvals got outdated and were removed: Code-Review+2 by cron2 Change subject: ps: Clean up conversion warnings in journal_add function ...................................................................... ps: Clean up conversion warnings in journal_add function Since these are only local variables, these are trivial changes. Change-Id: I0f2fff8358d4645c4ace504c65ae8559a68794cc Signed-off-by: Frank Lichtenheld Acked-by: Gert Doering Message-Id: <20250914134713.19315-1-gert@...1296...> URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg32= 916.html URL: https://gerrit.openvpn.net/c/openvpn/+/1163 Signed-off-by: Gert Doering --- M src/openvpn/ps.c 1 file changed, 7 insertions(+), 11 deletions(-) git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/63/1163/2 diff --git a/src/openvpn/ps.c b/src/openvpn/ps.c index eae03e3..e95a33b 100644 --- a/src/openvpn/ps.c +++ b/src/openvpn/ps.c @@ -334,26 +334,22 @@ static void journal_add(const char *journal_dir, struct proxy_connection *pc, struct p= roxy_connection *cp) { - struct gc_arena gc =3D gc_new(); struct openvpn_sockaddr from, to; - socklen_t slen, dlen; - int fnlen; - char *jfn; - int fd; - slen =3D sizeof(from.addr); - dlen =3D sizeof(to.addr); + socklen_t slen =3D sizeof(from.addr); + socklen_t dlen =3D sizeof(to.addr); if (!getpeername(pc->sd, (struct sockaddr *)&from.addr.sa, &slen) && !getsockname(cp->sd, (struct sockaddr *)&to.addr.sa, &dlen)) { + struct gc_arena gc =3D gc_new(); const char *f =3D print_openvpn_sockaddr(&from, &gc); const char *t =3D print_openvpn_sockaddr(&to, &gc); - fnlen =3D strlen(journal_dir) + strlen(t) + 2; - jfn =3D (char *)malloc(fnlen); + size_t fnlen =3D strlen(journal_dir) + strlen(t) + 2; + char *jfn =3D (char *)malloc(fnlen); check_malloc_return(jfn); snprintf(jfn, fnlen, "%s/%s", journal_dir, t); dmsg(D_PS_PROXY_DEBUG, "PORT SHARE PROXY: client origin %s -> %s",= jfn, f); - fd =3D platform_open(jfn, O_CREAT | O_TRUNC | O_WRONLY, S_IRUSR | = S_IWUSR | S_IRGRP); + int fd =3D platform_open(jfn, O_CREAT | O_TRUNC | O_WRONLY, S_IRUS= R | S_IWUSR | S_IRGRP); if (fd !=3D -1) { if (write(fd, f, strlen(f)) !=3D strlen(f)) @@ -368,8 +364,8 @@ msg(M_WARN | M_ERRNO, "PORT SHARE: unable to write journal fil= e in %s", jfn); free(jfn); } + gc_free(&gc); } - gc_free(&gc); } =20 /* -- To view, visit http://gerrit.openvpn.net/c/openvpn/+/1163?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: I0f2fff8358d4645c4ace504c65ae8559a68794cc Gerrit-Change-Number: 1163 Gerrit-PatchSet: 2 Gerrit-Owner: flichtenheld Gerrit-Reviewer: cron2 Gerrit-Reviewer: plaisthos Gerrit-CC: openvpn-devel Gerrit-MessageType: newpatchset --yZCtXPsP/mw= Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable

cron2 uploaded patch set #2 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: Clean up conversion warnings in journal_add func=
tion

Since these are only local variables, these are trivial
chan= ges.

Change-Id: I0f2fff8358d4645c4ace504c65ae8559a68794cc
Signed-= off-by: Frank Lichtenheld <frank@...2641...>
Acked-by: Gert Doerin= g <gert@...1296...>
Message-Id: <20250914134713.19315-1-gert@...1186...= .1296...>
URL: https://www.mail-archive.com/openvpn-devel@...1011...= eforge.net/msg32916.html
URL: https://gerrit.openvpn.net/c/openvpn/+/116= 3
Signed-off-by: Gert Doering <gert@...1296...>
---
M src/op= envpn/ps.c
1 file changed, 7 insertions(+), 11 deletions(-)

gi=
t pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/63/1163/2
<= pre style=3D"font-family: monospace,monospace; white-space: pre-wrap;">diff --git a/src/openvpn/ps.c b/src/openvpn/ps.c
index ea= e03e3..e95a33b 100644
--- a/src/openvpn/ps.c
+++ b/src/openvpn/ps.c
@@ -334,26 +334,22 @@
static void
journal_add(const char *journal_dir, stru= ct proxy_connection *pc, struct proxy_connection *cp)
{

- struct gc_arena gc = =3D gc_new();
struct openvpn_sockaddr from, to;=
- socklen_t slen, dlen;
- int fnlen;- char *jfn;
- int fd;
- slen =3D sizeof(from.addr)= ;
- dlen =3D sizeof(= to.addr);
+ sockle= n_t slen =3D sizeof(from.addr);
+ socklen_t dlen =3D sizeof(to.addr);
if= (!getpeername(pc->sd, (struct sockaddr *)&from.addr.sa, &slen)<= /span>
&& !getsockname(cp->sd, (struct sockadd= r *)&to.addr.sa, &dlen))
{
+ struct gc_arena gc =3D gc_new()= ;
const char *f =3D print_openvpn_sockaddr(&fr= om, &gc);
const char *t =3D print_openvpn_sock= addr(&to, &gc);
- fnlen =3D strlen(journal_dir) + strlen(t) + 2;
- jfn =3D (char *)malloc(fnlen);
+ size_t fnlen = =3D strlen(journal_dir) + strlen(t) + 2;
+ char *jfn =3D (char *)malloc(fnlen); check_malloc_return(jfn);
snprintf= (jfn, fnlen, "%s/%s", journal_dir, t);
d= msg(D_PS_PROXY_DEBUG, "PORT SHARE PROXY: client origin %s -> %s&quo= t;, jfn, f);
- f= d =3D platform_open(jfn, O_CREAT | O_TRUNC | O_WRONLY, S_IRUSR | S_IWUSR | = S_IRGRP);
+ in= t fd =3D platform_open(jfn, O_CREAT | O_TRUNC | O_WRONLY, S_IRUSR | S_IWUSR= | S_IRGRP);
if (fd !=3D -1)
= {
if (write(fd, f, strlen(f)) !=3D strlen(= f))
@@ -368,8 +364,8 @@
msg(M_= WARN | M_ERRNO, "PORT SHARE: unable to write journal file in %s",= jfn);
free(jfn);
}
+ gc_free(&= gc);
}
- gc_free(&gc);
}

= /*

To view, visit change 1163. To un= subscribe, or for help writing mail filters, visit settings.

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I0f2fff8358d4645c4ace504c65a= e8559a68794cc
Gerrit-Change-Number: 1163
Gerrit-PatchSet: 2
Gerrit-Owner: flichtenheld <frank@...2723...= .>
Gerrit-Reviewer: cron2 <gert@...1296...>=
Gerrit-Reviewer: plaisthos <arne-openvpn@...1186...= .1227...>
Gerrit-CC: openvpn-devel <openvpn-devel@...1484...= ts.sourceforge.net>
Gerrit-MessageType: newpatchset
--yZCtXPsP/mw=--