From 9c65b04f5b7e505dd5b95d5012b475129eebaea3 Mon Sep 17 00:00:00 2001 From: VladimirMangos Date: Wed, 18 May 2011 03:54:46 +0400 Subject: [PATCH] [11502] Fixed windows service run after adding posix daemon support --- src/mangosd/Main.cpp | 11 +++++++++++ src/realmd/Main.cpp | 15 +++++++++++++-- src/shared/revision_nr.h | 2 +- 3 files changed, 25 insertions(+), 3 deletions(-) diff --git a/src/mangosd/Main.cpp b/src/mangosd/Main.cpp index 3be1ba9c1..4eea42df0 100644 --- a/src/mangosd/Main.cpp +++ b/src/mangosd/Main.cpp @@ -87,12 +87,14 @@ extern int main(int argc, char **argv) ACE_Get_Opt cmd_opts(argc, argv, options); cmd_opts.long_option("version", 'v'); +#ifndef WIN32 // need call before options for posix daemon if (!sConfig.SetSource(cfg_file)) { sLog.outError("Could not find configuration file %s.", cfg_file); Log::WaitBeforeContinueIfNeed(); return 1; } +#endif int option; while ((option = cmd_opts()) != EOF) @@ -161,6 +163,15 @@ extern int main(int argc, char **argv) } } +#ifdef WIN32 // need call after options for windows service + if (!sConfig.SetSource(cfg_file)) + { + sLog.outError("Could not find configuration file %s.", cfg_file); + Log::WaitBeforeContinueIfNeed(); + return 1; + } +#endif + sLog.outString( "%s [world-daemon]", _FULLVERSION(REVISION_DATE,REVISION_TIME,REVISION_NR,REVISION_ID) ); sLog.outString( " to stop.\n\n" ); diff --git a/src/realmd/Main.cpp b/src/realmd/Main.cpp index 08356dbd4..49d5be4ca 100644 --- a/src/realmd/Main.cpp +++ b/src/realmd/Main.cpp @@ -96,14 +96,16 @@ extern int main(int argc, char **argv) ACE_Get_Opt cmd_opts(argc, argv, options); cmd_opts.long_option("version", 'v'); - int option; - +#ifndef WIN32 // need call before options for posix daemon if (!sConfig.SetSource(cfg_file)) { sLog.outError("Could not find configuration file %s.", cfg_file); Log::WaitBeforeContinueIfNeed(); return 1; } +#endif + + int option; while ((option = cmd_opts()) != EOF) { @@ -171,6 +173,15 @@ extern int main(int argc, char **argv) } } +#ifdef WIN32 // need call after options for windows service + if (!sConfig.SetSource(cfg_file)) + { + sLog.outError("Could not find configuration file %s.", cfg_file); + Log::WaitBeforeContinueIfNeed(); + return 1; + } +#endif + sLog.Initialize(); sLog.outString( "%s [realm-daemon]", _FULLVERSION(REVISION_DATE,REVISION_TIME,REVISION_NR,REVISION_ID) ); diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index bb75227ed..1dd815309 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "11501" + #define REVISION_NR "11502" #endif // __REVISION_NR_H__