From 922069afab3804acdd53b5daeef35e6a603d43b2 Mon Sep 17 00:00:00 2001 From: brain Date: Sat, 24 Mar 2007 18:50:40 +0000 Subject: Fix two things: (1) log gets replaced by a user fd after restart causing debug log to go to a user's status window (!) (2) restart failing due to segfault within libc (this is because some moron decided that stdin, stdout, and stderr should still be non-null if the files arent actually open!) git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@6707 e03df62e-2008-0410-955e-edbf42e46eb7 --- src/socket.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'src/socket.cpp') diff --git a/src/socket.cpp b/src/socket.cpp index 67931e49b..7a746ba0f 100644 --- a/src/socket.cpp +++ b/src/socket.cpp @@ -55,8 +55,10 @@ ListenSocket::~ListenSocket() { if (this->GetFd() > -1) { - shutdown(this->fd, 2); - close(this->fd); + ServerInstance->SE->DelFd(this); + ServerInstance->Log(DEBUG,"Shut down listener on fd %d", this->fd); + if (shutdown(this->fd, 2) || close(this->fd)) + ServerInstance->Log(DEBUG,"Failed to cancel listener: %s", strerror(errno)); this->fd = -1; } } @@ -419,12 +421,14 @@ bool InspIRCd::BindSocket(int sockfd, int port, char* addr, bool dolisten) } else { + this->Log(DEBUG,"New socket binding for %d with listen: %s:%d", sockfd, addr, port); NonBlocking(sockfd); return true; } } else { + this->Log(DEBUG,"New socket binding for %d without listen: %s:%d", sockfd, addr, port); return true; } } -- cgit v1.2.3