summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorChris Wilson <chris+github@qwirx.com>2006-10-14 14:42:21 +0000
committerChris Wilson <chris+github@qwirx.com>2006-10-14 14:42:21 +0000
commitfe290e01bcb715e5fc55c98f072f2afe0d28e67c (patch)
tree675103b8467f223adcfe90df9705b0848bf3ebc3 /bin
parentcfc9e4fa0518394b557d6a55596b55f4eb0590b8 (diff)
* Replace global daemon object with a pointer, to allow deletion and
clean up reported memory leaks * No need to initialise Winsock here, now that lib/server/Daemon does it for us * Initialise logging properly (refs #3)
Diffstat (limited to 'bin')
-rw-r--r--bin/bbackupd/bbackupd.cpp23
1 files changed, 6 insertions, 17 deletions
diff --git a/bin/bbackupd/bbackupd.cpp b/bin/bbackupd/bbackupd.cpp
index 3c283596..e00d3628 100644
--- a/bin/bbackupd/bbackupd.cpp
+++ b/bin/bbackupd/bbackupd.cpp
@@ -19,7 +19,7 @@
#include "Win32ServiceFunctions.h"
#include "Win32BackupService.h"
- extern Win32BackupService gDaemonService;
+ extern Win32BackupService* gpDaemonService;
#endif
int main(int argc, const char *argv[])
@@ -28,7 +28,7 @@ int main(int argc, const char *argv[])
#ifdef WIN32
- ::openlog("Box Backup (bbackupd)", 0, 0);
+ ::openlog("Box Backup (bbackupd)", LOG_PID, LOG_LOCAL6);
if(argc == 2 &&
(::strcmp(argv[1], "--help") == 0 ||
@@ -57,18 +57,8 @@ int main(int argc, const char *argv[])
{
runAsWin32Service = true;
}
-
- // Under win32 we must initialise the Winsock library
- // before using sockets
-
- WSADATA info;
- if (WSAStartup(0x0101, &info) == SOCKET_ERROR)
- {
- // box backup will not run without sockets
- ::syslog(LOG_ERR, "Failed to initialise Windows Sockets");
- THROW_EXCEPTION(BackupStoreException, Internal)
- }
+ gpDaemonService = new Win32BackupService();
EnableBackupRights();
@@ -95,15 +85,14 @@ int main(int argc, const char *argv[])
}
else
{
- ExitCode = gDaemonService.Main(
+ ExitCode = gpDaemonService->Main(
BOX_FILE_BBACKUPD_DEFAULT_CONFIG, argc, argv);
}
- // Clean up our sockets
- WSACleanup();
-
::closelog();
+ delete gpDaemonService;
+
return ExitCode;
#else // !WIN32