]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/socket.cpp
Make the UNIX socket listener path relative to the runtime path.
[user/henk/code/inspircd.git] / src / socket.cpp
index 736e094865d35cdb36d6a299eeb4d4f674e91492..37d0fb73bef71eb9c7ab9a521dc6e44528d4df08 100644 (file)
@@ -1,11 +1,17 @@
 /*
  * InspIRCd -- Internet Relay Chat Daemon
  *
- *   Copyright (C) 2009-2010 Daniel De Graaf <danieldg@inspircd.org>
- *   Copyright (C) 2007-2008 Robin Burchell <robin+git@viroteck.net>
- *   Copyright (C) 2005-2008 Craig Edwards <craigedwards@brainbox.cc>
+ *   Copyright (C) 2019 linuxdaemon <linuxdaemon.irc@gmail.com>
+ *   Copyright (C) 2014 Attila Molnar <attilamolnar@hush.com>
+ *   Copyright (C) 2013, 2017-2020 Sadie Powell <sadie@witchery.services>
+ *   Copyright (C) 2013 Daniel Vassdal <shutter@canternet.org>
+ *   Copyright (C) 2012 Robby <robby@chatbelgie.be>
+ *   Copyright (C) 2009-2011 Daniel De Graaf <danieldg@inspircd.org>
+ *   Copyright (C) 2009 Uli Schlachter <psychon@inspircd.org>
+ *   Copyright (C) 2008 Thomas Stagner <aquanight@inspircd.org>
+ *   Copyright (C) 2007 John Brooks <special@inspircd.org>
  *   Copyright (C) 2007 Dennis Friis <peavey@inspircd.org>
- *   Copyright (C) 2006 Oliver Lupton <oliverlupton@gmail.com>
+ *   Copyright (C) 2006 Craig Edwards <brain@inspircd.org>
  *
  * This file is part of InspIRCd.  InspIRCd is free software: you can
  * redistribute it and/or modify it under the terms of the GNU General Public
@@ -41,7 +47,7 @@ bool InspIRCd::BindPort(ConfigTag* tag, const irc::sockets::sockaddrs& sa, std::
        }
 
        ListenSocket* ll = new ListenSocket(tag, sa);
-       if (ll->GetFd() < 0)
+       if (!ll->HasFd())
        {
                ServerInstance->Logs->Log("SOCKET", LOG_DEFAULT, "Failed to listen on %s from tag at %s: %s",
                        sa.str().c_str(), tag->getTagLocation().c_str(), strerror(errno));
@@ -86,7 +92,7 @@ size_t InspIRCd::BindPorts(FailedPortList& failed_ports)
                                        continue;
 
                                if (!BindPort(tag, bindspec, old_ports))
-                                       failed_ports.push_back(std::make_pair(bindspec, errno));
+                                       failed_ports.push_back(FailedPort(errno, bindspec, tag));
                                else
                                        bound++;
                        }
@@ -99,7 +105,7 @@ size_t InspIRCd::BindPorts(FailedPortList& failed_ports)
                if (!path.empty())
                {
                        // Expand the path relative to the config directory.
-                       const std::string fullpath = ServerInstance->Config->Paths.PrependData(path);
+                       const std::string fullpath = ServerInstance->Config->Paths.PrependRuntime(path);
 
                        // UNIX socket paths are length limited to less than PATH_MAX.
                        irc::sockets::sockaddrs bindspec;
@@ -120,7 +126,7 @@ size_t InspIRCd::BindPorts(FailedPortList& failed_ports)
 
                        irc::sockets::untosa(fullpath, bindspec);
                        if (!BindPort(tag, bindspec, old_ports))
-                               failed_ports.push_back(std::make_pair(bindspec, errno));
+                               failed_ports.push_back(FailedPort(errno, bindspec, tag));
                        else
                                bound++;
                }