From 0ea06b9c632af2fe09cdea8be0baa9ae6e538aeb Mon Sep 17 00:00:00 2001 From: Luke Bratch Date: Wed, 12 Jun 2019 20:31:39 +0100 Subject: Handle failing to connect to the server on startup. --- blabouncer.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'blabouncer.c') diff --git a/blabouncer.c b/blabouncer.c index 0db2dca..c416c3e 100644 --- a/blabouncer.c +++ b/blabouncer.c @@ -1053,7 +1053,11 @@ int main(int argc, char *argv[]) { // I will try to keep to the notation of "server" meaning the real IRCd, "bouncer" meaning the bouncer, and "client" meaning the real IRC client // Create server socket - int serversockfd = createserversocket(settings.ircserver, settings.ircserverport); + int serversockfd; + if ((serversockfd = createserversocket(settings.ircserver, settings.ircserverport)) == -1) { + debugprint(DEBUG_CRIT, "main(): Couldn't connect to server, exiting.\n"); + exit(1); + } // Create client socket (after server so we can use its fd number later as fdmax) int clientsockfd = createclientsocket(settings.clientport); -- cgit v1.2.3