summaryrefslogtreecommitdiff
path: root/blabouncer.c
diff options
context:
space:
mode:
authorLuke Bratch <luke@bratch.co.uk>2019-06-12 20:31:39 +0100
committerLuke Bratch <luke@bratch.co.uk>2019-06-12 21:28:34 +0100
commit0ea06b9c632af2fe09cdea8be0baa9ae6e538aeb (patch)
tree8d7fdc93aa0a0f5c64b0441f93e30d12702580b1 /blabouncer.c
parent511e258e901e5248e1706609ba1099507fd750ae (diff)
Handle failing to connect to the server on startup.
Diffstat (limited to 'blabouncer.c')
-rw-r--r--blabouncer.c6
1 files changed, 5 insertions, 1 deletions
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);