Skip to content

Commit

Permalink
[11502] Fixed windows service run after adding posix daemon support
Browse files Browse the repository at this point in the history
  • Loading branch information
VladimirMangos committed May 17, 2011
1 parent fce30b4 commit 0f9fa7d
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 3 deletions.
11 changes: 11 additions & 0 deletions src/mangosd/Main.cpp
Expand Up @@ -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)
Expand Down Expand Up @@ -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( "<Ctrl-C> to stop.\n\n" );

Expand Down
15 changes: 13 additions & 2 deletions src/realmd/Main.cpp
Expand Up @@ -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)
{
Expand Down Expand Up @@ -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) );
Expand Down
2 changes: 1 addition & 1 deletion 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__

0 comments on commit 0f9fa7d

Please sign in to comment.