mirror of
https://github.com/OpenVPN/openvpn.git
synced 2026-05-28 04:03:29 -04:00
replace assert() calls with ASSERT()
OpenVPN's ASSERT() macro will do a bit more than the standard-libc assert() call, namely print out which function and what expression failed, before calling _exit(1). Also, it can not be accidentially compiled-away (-DNDEBUG). Use of ASSERT() is generally only advised in cases of "this must not happen, but if it does, it's a programming or state corruption error that we must know about". Use of assert() is lacking the extra debug info, and as such, not advised at all. Change-Id: I6480d6f741c2368a0d951004b91167d5943f8f9d Signed-off-by: Gert Doering <gert@greenie.muc.de> Acked-by: mandree <matthias.andree@gmx.de> Message-Id: <20250907211252.23924-1-gert@greenie.muc.de> URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg32824.html Signed-off-by: Gert Doering <gert@greenie.muc.de>
This commit is contained in:
parent
1e7b9a0fb0
commit
88f8edbf75
3 changed files with 8 additions and 8 deletions
|
|
@ -100,7 +100,7 @@ nvlist_to_sockaddr(const nvlist_t *nvl, struct sockaddr_storage *ss)
|
|||
|
||||
in->sin_len = sizeof(*in);
|
||||
data = nvlist_get_binary(nvl, "address", &len);
|
||||
assert(len == sizeof(in->sin_addr));
|
||||
ASSERT(len == sizeof(in->sin_addr));
|
||||
memcpy(&in->sin_addr, data, sizeof(in->sin_addr));
|
||||
in->sin_port = nvlist_get_number(nvl, "port");
|
||||
break;
|
||||
|
|
@ -114,7 +114,7 @@ nvlist_to_sockaddr(const nvlist_t *nvl, struct sockaddr_storage *ss)
|
|||
|
||||
in6->sin6_len = sizeof(*in6);
|
||||
data = nvlist_get_binary(nvl, "address", &len);
|
||||
assert(len == sizeof(in6->sin6_addr));
|
||||
ASSERT(len == sizeof(in6->sin6_addr));
|
||||
memcpy(&in6->sin6_addr, data, sizeof(in6->sin6_addr));
|
||||
in6->sin6_port = nvlist_get_number(nvl, "port");
|
||||
|
||||
|
|
|
|||
|
|
@ -319,7 +319,7 @@ management_callback_send_cc_message(void *arg, const char *command, const char *
|
|||
static unsigned int
|
||||
management_callback_remote_entry_count(void *arg)
|
||||
{
|
||||
assert(arg);
|
||||
ASSERT(arg);
|
||||
struct context *c = (struct context *)arg;
|
||||
struct connection_list *l = c->options.connection_list;
|
||||
|
||||
|
|
@ -329,8 +329,8 @@ management_callback_remote_entry_count(void *arg)
|
|||
static bool
|
||||
management_callback_remote_entry_get(void *arg, unsigned int index, char **remote)
|
||||
{
|
||||
assert(arg);
|
||||
assert(remote);
|
||||
ASSERT(arg);
|
||||
ASSERT(remote);
|
||||
|
||||
struct context *c = (struct context *)arg;
|
||||
struct connection_list *l = c->options.connection_list;
|
||||
|
|
|
|||
|
|
@ -3486,9 +3486,9 @@ tuntap_options_postprocess_dns(struct options *o)
|
|||
{
|
||||
/* Copy --dhcp-options to tuntap_options */
|
||||
struct dhcp_options *dhcp = &dns->from_dhcp;
|
||||
assert(sizeof(dhcp->dns) == sizeof(tt->dns));
|
||||
assert(sizeof(dhcp->dns6) == sizeof(tt->dns6));
|
||||
assert(sizeof(dhcp->domain_search_list) == sizeof(tt->domain_search_list));
|
||||
ASSERT(sizeof(dhcp->dns) == sizeof(tt->dns));
|
||||
ASSERT(sizeof(dhcp->dns6) == sizeof(tt->dns6));
|
||||
ASSERT(sizeof(dhcp->domain_search_list) == sizeof(tt->domain_search_list));
|
||||
|
||||
tt->domain = dhcp->domain;
|
||||
tt->dns_len = dhcp->dns_len;
|
||||
|
|
|
|||
Loading…
Reference in a new issue