From fb8311e48f5ee4a4d11299ee7aadabca581eb1da Mon Sep 17 00:00:00 2001 From: Omar Polo Date: Mon, 17 Jun 2024 20:47:24 +0000 Subject: replace asserts with error returns --- gmid.h | 3 --- proxy-proto.c | 7 ++++--- server.c | 1 - 3 files changed, 4 insertions(+), 7 deletions(-) diff --git a/gmid.h b/gmid.h index 7cb8de1..8c8ec7c 100644 --- a/gmid.h +++ b/gmid.h @@ -34,7 +34,6 @@ #include #include #include -#include #include @@ -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; diff --git a/server.c b/server.c index b8ab2f2..f3e34f3 100644 --- a/server.c +++ b/server.c @@ -19,7 +19,6 @@ #include #include -#include #include #include #include -- cgit v1.2.3