summaryrefslogtreecommitdiff
path: root/src/socket.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/socket.cpp')
-rw-r--r--src/socket.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/socket.cpp b/src/socket.cpp
index 04a4f5f15..1916bb555 100644
--- a/src/socket.cpp
+++ b/src/socket.cpp
@@ -359,8 +359,14 @@ int BindPorts(bool bail)
/* Associate the new open port with a slot in the socket engine */
if (Config->openSockfd[count] > -1)
{
- ServerInstance->SE->AddFd(Config->openSockfd[count],true,X_LISTEN);
- BoundPortCount++;
+ if (!ServerInstance->SE->AddFd(Config->openSockfd[count],true,X_LISTEN))
+ {
+ log(DEFAULT,"ERK! Failed to add listening port to socket engine!");
+ shutdown(Config->openSockfd[count],2);
+ close(Config->openSockfd[count]);
+ }
+ else
+ BoundPortCount++;
}
}
}