summaryrefslogtreecommitdiff
path: root/sockets.c
diff options
context:
space:
mode:
authorLuke Bratch <luke@bratch.co.uk>2020-10-21 23:56:50 +0100
committerLuke Bratch <luke@bratch.co.uk>2020-10-21 23:56:50 +0100
commit80881f04e70b1708a303ae71774b87301f8deb38 (patch)
tree417b48760bc30491f7a975350feeb4e8414d90f7 /sockets.c
parentb09cbe8b3575ec018f7d73a0bcd751dba011fc72 (diff)
Don't have arrindex() return 0 on failure as 0 is a valid index. Instead return -1 and change callers to check this.
Diffstat (limited to 'sockets.c')
-rw-r--r--sockets.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/sockets.c b/sockets.c
index f201d79..c075232 100644
--- a/sockets.c
+++ b/sockets.c
@@ -277,6 +277,10 @@ int fd_toggle_blocking(int fd, int blocking) {
int openssl_accept(int fd, struct client *clients, struct ircdstate *ircdstate, struct settings *settings, struct clientcodes *clientcodes) {
// Get the index of the this client fd
int clientindex = arrindex(clients, fd);
+ if (clientindex < 0) {
+ debugprint(DEBUG_CRIT, "openssl_accept(): error: arrindex() returned '%d', exiting!\n", clientindex);
+ exit(1);
+ }
// Clear OpenSSL errors before proceeding so we can reliably get errors from SSL_accept
ERR_clear_error();