From 91b6e288a49ee57a4eeeff3f22f2440c94594a1d Mon Sep 17 00:00:00 2001 From: Frank Lichtenheld Date: Thu, 5 Dec 2024 22:41:58 +0100 Subject: [PATCH] Fix some formatting related to if/else and macros Make it clearer where the blocks are. Change-Id: If645c3faf149bac82167a91be13541b30a1b8d6a Signed-off-by: Frank Lichtenheld Acked-by: Lev Stipakov Message-Id: <20241205214158.23542-1-gert@greenie.muc.de> URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg30027.html Signed-off-by: Gert Doering --- src/openvpn/helper.c | 4 ++-- src/openvpn/manage.c | 12 ++++++++---- src/openvpn/openvpn.c | 6 +++--- src/openvpn/route.c | 5 +++-- src/openvpn/socket.c | 6 ++++-- src/openvpn/ssl.c | 4 +++- 6 files changed, 23 insertions(+), 14 deletions(-) diff --git a/src/openvpn/helper.c b/src/openvpn/helper.c index bbdbc041313..9e28e87c4e0 100644 --- a/src/openvpn/helper.c +++ b/src/openvpn/helper.c @@ -500,7 +500,7 @@ helper_client_server(struct options *o) push_option(o, print_opt_route_gateway_dhcp(&o->gc), M_USAGE); } } - else + /* * HELPER DIRECTIVE: * @@ -511,7 +511,7 @@ helper_client_server(struct options *o) * pull * tls-client */ - if (o->client) + else if (o->client) { o->pull = true; o->tls_client = true; diff --git a/src/openvpn/manage.c b/src/openvpn/manage.c index f296788bef0..e79a1184c4c 100644 --- a/src/openvpn/manage.c +++ b/src/openvpn/manage.c @@ -1822,7 +1822,9 @@ man_accept(struct management *man) } else #endif - man->connection.sd_cli = socket_do_accept(man->connection.sd_top, &act, false); + { + man->connection.sd_cli = socket_do_accept(man->connection.sd_top, &act, false); + } if (socket_defined(man->connection.sd_cli)) { @@ -1971,9 +1973,11 @@ man_connect(struct management *man) } else #endif - msg(D_LINK_ERRORS | M_ERRNO, - "MANAGEMENT: connect to %s failed", - print_sockaddr(man->settings.local->ai_addr, &gc)); + { + msg(D_LINK_ERRORS | M_ERRNO, + "MANAGEMENT: connect to %s failed", + print_sockaddr(man->settings.local->ai_addr, &gc)); + } throw_signal_soft(SIGTERM, "management-connect-failed"); goto done; } diff --git a/src/openvpn/openvpn.c b/src/openvpn/openvpn.c index 1db5422446e..c52540c2533 100644 --- a/src/openvpn/openvpn.c +++ b/src/openvpn/openvpn.c @@ -274,10 +274,10 @@ openvpn_main(int argc, char *argv[]) /* Query passwords before becoming a daemon if we don't use the * management interface to get them. */ -#ifdef ENABLE_MANAGEMENT if (!(c.options.management_flags & MF_QUERY_PASSWORDS)) -#endif - init_query_passwords(&c); + { + init_query_passwords(&c); + } /* become a daemon if --daemon */ if (c.first_time) diff --git a/src/openvpn/route.c b/src/openvpn/route.c index df06fdf7f59..d17b285f7ae 100644 --- a/src/openvpn/route.c +++ b/src/openvpn/route.c @@ -3914,8 +3914,9 @@ get_default_gateway_ipv6(struct route_ipv6_gateway_info *rgi6, } else #endif - - rgi6->gateway.addr_ipv6 = gw; + { + rgi6->gateway.addr_ipv6 = gw; + } rgi6->flags |= RGI_ADDR_DEFINED; if (ifp) diff --git a/src/openvpn/socket.c b/src/openvpn/socket.c index efd742c60d7..01874fe273e 100644 --- a/src/openvpn/socket.c +++ b/src/openvpn/socket.c @@ -3389,8 +3389,10 @@ link_socket_read_udp_posix(struct link_socket *sock, } else #endif - buf->len = recvfrom(sock->sd, BPTR(buf), buf_forward_capacity(buf), 0, - &from->dest.addr.sa, &fromlen); + { + buf->len = recvfrom(sock->sd, BPTR(buf), buf_forward_capacity(buf), 0, + &from->dest.addr.sa, &fromlen); + } /* FIXME: won't do anything when sock->info.af == AF_UNSPEC */ if (buf->len >= 0 && expectedlen && fromlen != expectedlen) { diff --git a/src/openvpn/ssl.c b/src/openvpn/ssl.c index 1f8eb1ec7fe..33c22b48373 100644 --- a/src/openvpn/ssl.c +++ b/src/openvpn/ssl.c @@ -327,7 +327,9 @@ auth_user_pass_setup(const char *auth_file, bool is_inline, } else #endif /* ifdef ENABLE_MANAGEMENT */ - get_user_pass(&auth_user_pass, auth_file, UP_TYPE_AUTH, flags); + { + get_user_pass(&auth_user_pass, auth_file, UP_TYPE_AUTH, flags); + } } }