aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOmar Polo <op@omarpolo.com>2024-06-17 20:47:24 +0000
committerOmar Polo <op@omarpolo.com>2024-06-17 20:47:24 +0000
commitfb8311e48f5ee4a4d11299ee7aadabca581eb1da (patch)
tree31437cade13a8308a1ed7c06c4078e3efbd3e34d
parent27c6dc180f5ae74ef07f444ee3732ff95ca5bfff (diff)
replace asserts with error returns
-rw-r--r--gmid.h3
-rw-r--r--proxy-proto.c7
-rw-r--r--server.c1
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 <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;
diff --git a/server.c b/server.c
index b8ab2f2..f3e34f3 100644
--- a/server.c
+++ b/server.c
@@ -19,7 +19,6 @@
#include <sys/stat.h>
#include <sys/un.h>
-#include <assert.h>
#include <ctype.h>
#include <errno.h>
#include <event.h>