diff options
author | Luke Bratch <luke@bratch.co.uk> | 2020-10-21 23:56:50 +0100 |
---|---|---|
committer | Luke Bratch <luke@bratch.co.uk> | 2020-10-21 23:56:50 +0100 |
commit | 80881f04e70b1708a303ae71774b87301f8deb38 (patch) | |
tree | 417b48760bc30491f7a975350feeb4e8414d90f7 /sockets.c | |
parent | b09cbe8b3575ec018f7d73a0bcd751dba011fc72 (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.c | 4 |
1 files changed, 4 insertions, 0 deletions
@@ -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(); |