Attention is currently required from: plaisthos.
Hello plaisthos,
I'd like you to do a code review.
Please visit
http://gerrit.openvpn.net/c/openvpn/+/1163?usp=email
to review the following change.
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 <[email protected]>
---
M src/openvpn/ps.c
1 file changed, 7 insertions(+), 11 deletions(-)
git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/63/1163/1
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
proxy_connection *cp)
{
- struct gc_arena gc = gc_new();
struct openvpn_sockaddr from, to;
- socklen_t slen, dlen;
- int fnlen;
- char *jfn;
- int fd;
- slen = sizeof(from.addr);
- dlen = sizeof(to.addr);
+ socklen_t slen = sizeof(from.addr);
+ socklen_t dlen = 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 = gc_new();
const char *f = print_openvpn_sockaddr(&from, &gc);
const char *t = print_openvpn_sockaddr(&to, &gc);
- fnlen = strlen(journal_dir) + strlen(t) + 2;
- jfn = (char *)malloc(fnlen);
+ size_t fnlen = strlen(journal_dir) + strlen(t) + 2;
+ char *jfn = (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 = platform_open(jfn, O_CREAT | O_TRUNC | O_WRONLY, S_IRUSR |
S_IWUSR | S_IRGRP);
+ int fd = platform_open(jfn, O_CREAT | O_TRUNC | O_WRONLY, S_IRUSR |
S_IWUSR | S_IRGRP);
if (fd != -1)
{
if (write(fd, f, strlen(f)) != 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 http://gerrit.openvpn.net/c/openvpn/+/1163?usp=email
To unsubscribe, or for help writing mail filters, visit
http://gerrit.openvpn.net/settings
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I0f2fff8358d4645c4ace504c65ae8559a68794cc
Gerrit-Change-Number: 1163
Gerrit-PatchSet: 1
Gerrit-Owner: flichtenheld <[email protected]>
Gerrit-Reviewer: plaisthos <[email protected]>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]>
Gerrit-MessageType: newchange
_______________________________________________
Openvpn-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openvpn-devel