X-Git-Url: https://git.lizzy.rs/?a=blobdiff_plain;f=src%2Fban.cpp;h=5bb470a676f5e6c3a010e50f26cb83990a65614b;hb=4e1f50035e860a00636ca5d804c267119df99601;hp=75bae746f9455131705a27763d382014ca6a7a7e;hpb=22e186b4aa88b585e71500c4e9a03bf69b0b6191;p=dragonfireclient.git diff --git a/src/ban.cpp b/src/ban.cpp index 75bae746f..5bb470a67 100644 --- a/src/ban.cpp +++ b/src/ban.cpp @@ -23,7 +23,9 @@ with this program; if not, write to the Free Software Foundation, Inc., #include #include #include "strfnd.h" +#include "util/string.h" #include "log.h" +#include "filesys.h" BanManager::BanManager(const std::string &banfilepath): m_banfilepath(banfilepath), @@ -76,20 +78,20 @@ void BanManager::save() { JMutexAutoLock lock(m_mutex); infostream<<"BanManager: saving to "<::iterator i = m_ips.begin(); i != m_ips.end(); i++) { - os<first<<"|"<second<<"\n"; + ss << i->first << "|" << i->second << "\n"; } + + if(!fs::safeWriteToFile(m_banfilepath, ss.str())) { + infostream<<"BanManager: failed saving to "<