diff options
author | Omar Polo <op@omarpolo.com> | 2024-06-17 20:47:24 +0000 |
---|---|---|
committer | Omar Polo <op@omarpolo.com> | 2024-06-17 20:47:24 +0000 |
commit | fb8311e48f5ee4a4d11299ee7aadabca581eb1da (patch) | |
tree | 31437cade13a8308a1ed7c06c4078e3efbd3e34d | |
parent | 27c6dc180f5ae74ef07f444ee3732ff95ca5bfff (diff) |
replace asserts with error returns
-rw-r--r-- | gmid.h | 3 | ||||
-rw-r--r-- | proxy-proto.c | 7 | ||||
-rw-r--r-- | server.c | 1 |
3 files changed, 4 insertions, 7 deletions
@@ -34,7 +34,6 @@ #include <time.h> #include <tls.h> #include <unistd.h> -#include <assert.h> #include <openssl/x509.h> @@ -60,8 +59,6 @@ #define GMID_VERSION "gmid/" VERSION -#define ASSERT_MSG(expr, msg) assert(((void)msg, (expr))) - #define GEMINI_URL_LEN (1024+3) /* URL max len + \r\n + \0 */ #define SUCCESS 20 diff --git a/proxy-proto.c b/proxy-proto.c index 9dc1457..bef2633 100644 --- a/proxy-proto.c +++ b/proxy-proto.c @@ -159,15 +159,16 @@ proxy_proto_v1_parse(struct proxy_protocol_v1 *s, char *buf, size_t buflen, return (-1); break; - default: - ASSERT_MSG(0, "unimplemented"); + default: + return (-1); } if (check_port_v1(&s->srcport, &buf, &buflen) == -1 || check_port_v1(&s->dstport, &buf, &buflen) == -1) return (-1); - assert('\n' == *buf); + if (*buf != '\n') + return (-1); buf += 1; *consumed = buf - begin; @@ -19,7 +19,6 @@ #include <sys/stat.h> #include <sys/un.h> -#include <assert.h> #include <ctype.h> #include <errno.h> #include <event.h> |