]> git.netwichtig.de Git - user/henk/code/inspircd.git/commitdiff
Fix m_permchannels and m_xline_db on Windows
authorAdam <Adam@anope.org>
Thu, 8 May 2014 23:40:13 +0000 (19:40 -0400)
committerAdam <Adam@anope.org>
Thu, 8 May 2014 23:57:08 +0000 (19:57 -0400)
The call to remove() can fail if the database doesn't already exist. Just
ignore the error, which effectively makes the rename() call below work as
it does on nix

src/modules/m_permchannels.cpp
src/modules/m_xline_db.cpp

index 69a2826378f334ce171dfaeb551d7983dd0bcbde..e86b3cbf6d171dece2453c8e50e110680ad9c980 100644 (file)
@@ -156,12 +156,7 @@ static bool WriteDatabase(Module* mod, bool save_listmodes)
        }
 
 #ifdef _WIN32
-       if (remove(permchannelsconf.c_str()))
-       {
-               ServerInstance->Logs->Log("m_permchannels",DEFAULT, "permchannels: Cannot remove old database! %s (%d)", strerror(errno), errno);
-               ServerInstance->SNO->WriteToSnoMask('a', "database: cannot remove old database: %s (%d)", strerror(errno), errno);
-               return false;
-       }
+       remove(permchannelsconf.c_str());
 #endif
        // Use rename to move temporary to new db - this is guarenteed not to fuck up, even in case of a crash.
        if (rename(tempname.c_str(), permchannelsconf.c_str()) < 0)
index 5e83478c34d5c10c39b91639f7258c1740e93ca0..2237b0d081e8036217606e7a3c22de29d7b0942e 100644 (file)
@@ -147,12 +147,7 @@ class ModuleXLineDB : public Module
                }
 
 #ifdef _WIN32
-               if (remove(xlinedbpath.c_str()))
-               {
-                       ServerInstance->Logs->Log("m_xline_db",DEBUG, "xlinedb: Cannot remove old database! %s (%d)", strerror(errno), errno);
-                       ServerInstance->SNO->WriteToSnoMask('a', "database: cannot remove old database: %s (%d)", strerror(errno), errno);
-                       return false;
-               }
+               remove(xlinedbpath.c_str());
 #endif
                // Use rename to move temporary to new db - this is guarenteed not to fuck up, even in case of a crash.
                if (rename(xlinenewdbpath.c_str(), xlinedbpath.c_str()) < 0)