Change in openvpn[master]: init: Avoid sign-compare warnings
A message that is not in the archive (sent off-list or not yet received): gerrit.1773073753000.Ie0b94b596637d660392bc4eda48d16cfecfeb971@...2715...
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/+/1562?usp=email
to review the following change.
Change subject: init: Avoid sign-compare warnings
......................................................................
init: Avoid sign-compare warnings
- Use BLENZ instead of buf_len where applicable
- Fix some comparisons with ce list length
---
M src/openvpn/init.c
1 file changed, 6 insertions(+), 16 deletions(-)
git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/62/1562/1
src/openvpn/init.c +6 -16
@@ -325,11 +325,6 @@return l->len; } -#if defined(__GNUC__) || defined(__clang__) -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wsign-compare" -#endif -static bool management_callback_remote_entry_get (void *arg,unsigned int index,char **remote) {
@@ -340,7 +335,7 @@struct connection_list *l = c->options.connection_list;bool ret = true; -if (index < l->len) +if (l->len >0 && index < (unsigned int )l->len) {struct connection_entry *ce = l->array[index];const char *proto =proto2ascii (ce->proto, ce->af, false);
@@ -364,10 +359,6 @@return ret; } -#if defined(__GNUC__) || defined(__clang__) -#pragma GCC diagnostic pop -#endif -static bool management_callback_remote_cmd (void *arg,const char **p) {
@@ -466,7 +457,6 @@#if defined(__GNUC__) || defined(__clang__)#pragma GCC diagnostic push#pragma GCC diagnostic ignored "-Wconversion" -#pragma GCC diagnostic ignored "-Wsign-compare"#endif /*
@@ -638,8 +628,8 @@ }while (!ce_defined);/* Check if this connection attempt would bring us over the limit */ -if (c->options.connect_retry_max >0 - && c->options.unsuccessful_attempts > (l->len * c->options.connect_retry_max)) +int max_attempts = l->len * c->options.connect_retry_max; +if (max_attempts >0 && c->options.unsuccessful_attempts > (unsigned int )max_attempts) {msg (M_FATAL ,"All connections have been connect-retry-max (%d) times unsuccessful, exiting" , c->options.connect_retry_max);
@@ -2176,7 +2166,7 @@static void add_delim_if_non_empty (struct buffer *buf,const char *header) { -if (buf_len (buf) >strlen (header)) +if (BLENZ (buf) >strlen (header)) {buf_printf (buf,", " ); }
@@ -2264,7 +2254,7 @@buf_printf (&out,"session-timeout %d" , o->session_timeout); } -if (buf_len (&out) >strlen (header)) +if (BLENZ (&out) >strlen (header)) {msg (D_HANDSHAKE ,"%s" ,BSTR (&out)); }
@@ -2301,7 +2291,7 @@ } } -if (buf_len (&out) >strlen (header)) +if (BLENZ (&out) >strlen (header)) {msg (D_HANDSHAKE ,"%s" ,BSTR (&out)); }
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1562?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email
Gerrit-MessageType: newchange
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Ie0b94b596637d660392bc4eda48d16cfecfeb971
Gerrit-Change-Number: 1562
Gerrit-PatchSet: 1
Gerrit-Owner: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>