summaryrefslogtreecommitdiff
path: root/src/anytun.cpp
diff options
context:
space:
mode:
authorMarkus Grüneis <gimpf@gimpf.org>2010-02-16 19:17:43 +0000
committerMarkus Grüneis <gimpf@gimpf.org>2010-02-16 19:17:43 +0000
commit9865b9fde2d675d974d6a0414a4ec084e1905b84 (patch)
treeb54265a0e3225560701a01d3d82efe3333e9c70b /src/anytun.cpp
parentcleaned up manpages (diff)
fixed win32 build
Diffstat (limited to 'src/anytun.cpp')
-rw-r--r--src/anytun.cpp26
1 files changed, 12 insertions, 14 deletions
diff --git a/src/anytun.cpp b/src/anytun.cpp
index ddec0c0..a693e34 100644
--- a/src/anytun.cpp
+++ b/src/anytun.cpp
@@ -51,13 +51,13 @@
#include "keyDerivationFactory.h"
#include "signalController.h"
#ifndef _MSC_VER
-#include "daemonService.h"
+# include "daemonService.h"
#else
-#ifdef WIN_SERVICE
-#include "win32/winService.h"
-#else
-#include "nullDaemon.h"
-#endif
+# ifdef WIN_SERVICE
+# include "win32/winService.h"
+# else
+# include "nullDaemon.h"
+# endif
#endif
#include "packetSource.h"
#include "tunDevice.h"
@@ -69,7 +69,6 @@
#include "networkAddress.h"
#endif
-
#ifndef ANYTUN_NOSYNC
#include "syncQueue.h"
#include "syncCommand.h"
@@ -358,14 +357,13 @@ int main(int argc, char* argv[])
}
}
-int real_main(int argc, char* argv[], WinService* service)
+int real_main(int argc, char* argv[], WinService& service)
{
bool daemonized=true;
#else
int main(int argc, char* argv[])
{
- DaemonService daemon;
- DaemonService* service = &daemon;
+ DaemonService service;
bool daemonized=false;
#endif
try
@@ -390,9 +388,9 @@ int main(int argc, char* argv[])
gOpt.parse_post(); // print warnings
// daemonizing has to done before any thread gets started
- service->initPrivs(gOpt.getUsername(), gOpt.getGroupname());
+ service.initPrivs(gOpt.getUsername(), gOpt.getGroupname());
if(gOpt.getDaemonize()) {
- service->daemonize();
+ service.daemonize();
daemonized = true;
}
@@ -410,13 +408,13 @@ int main(int argc, char* argv[])
if(gOpt.getChrootDir() != "") {
try {
- service->chroot(gOpt.getChrootDir());
+ service.chroot(gOpt.getChrootDir());
}
catch(const std::runtime_error& e) {
cLog.msg(Log::PRIO_WARNING) << "ignoring chroot error: " << e.what();
}
}
- service->dropPrivs();
+ service.dropPrivs();
// this has to be called before the first thread is started
gSignalController.init(service);