summaryrefslogtreecommitdiffstats
path: root/Tools/MCADefrag/MCADefrag.cpp
diff options
context:
space:
mode:
authorelectromatter <electromatter@gmail.com>2015-09-22 04:44:34 +0200
committerelectromatter <electromatter@gmail.com>2015-09-22 04:44:34 +0200
commita24cc0184343416eed86b208d8a2aff2b5c0892c (patch)
tree04ced91aa4a70b4c6e033fac4a2fc2e2ea206205 /Tools/MCADefrag/MCADefrag.cpp
parentadded bungeecord support for protocol18x (diff)
parentMerge pull request #2488 from cuberite/ChatFlag (diff)
downloadcuberite-a24cc0184343416eed86b208d8a2aff2b5c0892c.tar
cuberite-a24cc0184343416eed86b208d8a2aff2b5c0892c.tar.gz
cuberite-a24cc0184343416eed86b208d8a2aff2b5c0892c.tar.bz2
cuberite-a24cc0184343416eed86b208d8a2aff2b5c0892c.tar.lz
cuberite-a24cc0184343416eed86b208d8a2aff2b5c0892c.tar.xz
cuberite-a24cc0184343416eed86b208d8a2aff2b5c0892c.tar.zst
cuberite-a24cc0184343416eed86b208d8a2aff2b5c0892c.zip
Diffstat (limited to 'Tools/MCADefrag/MCADefrag.cpp')
-rw-r--r--Tools/MCADefrag/MCADefrag.cpp20
1 files changed, 10 insertions, 10 deletions
diff --git a/Tools/MCADefrag/MCADefrag.cpp b/Tools/MCADefrag/MCADefrag.cpp
index 80c6f5be2..cf1db85d5 100644
--- a/Tools/MCADefrag/MCADefrag.cpp
+++ b/Tools/MCADefrag/MCADefrag.cpp
@@ -22,26 +22,26 @@ static const Byte g_Zeroes[4096] = {0};
int main(int argc, char ** argv)
{
- cLogger::cListener * consoleLogListener = MakeConsoleListener(false);
- cLogger::cListener * fileLogListener = new cFileListener();
- cLogger::GetInstance().AttachListener(consoleLogListener);
- cLogger::GetInstance().AttachListener(fileLogListener);
+ auto consoleLogListener = MakeConsoleListener(false);
+ auto consoleAttachment = cLogger::GetInstance().AttachListener(std::move(consoleLogListener));
+ auto fileLogListenerRet = MakeFileListener();
+ if (!fileLogListenerRet.first)
+ {
+ LOGERROR("Failed to open log file, aborting");
+ return EXIT_FAILURE;
+ }
+ auto fileAttachment = cLogger::GetInstance().AttachListener(std::move(fileLogListenerRet.second));
cLogger::InitiateMultithreading();
cMCADefrag Defrag;
if (!Defrag.Init(argc, argv))
{
- return 1;
+ return EXIT_FAILURE;
}
Defrag.Run();
- cLogger::GetInstance().DetachListener(consoleLogListener);
- delete consoleLogListener;
- cLogger::GetInstance().DetachListener(fileLogListener);
- delete fileLogListener;
-
return 0;
}