From 773f36bbed5d2238ccec29b8bb2517325e0934ec Mon Sep 17 00:00:00 2001 From: Nicolas Boichat Date: Sat, 24 Apr 2004 11:33:50 +0000 Subject: [PATCH] added WSACleanup(), corrected WSA_Init() (removed #ifdef) git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@1289 91ce42f0-d328-0410-95d8-f526ca767f89 --- bacula/src/console/console.c | 7 ++++--- bacula/src/filed/win32/winmain.cpp | 3 +-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/bacula/src/console/console.c b/bacula/src/console/console.c index d3f0fcd4e0..89c658e551 100644 --- a/bacula/src/console/console.c +++ b/bacula/src/console/console.c @@ -381,9 +381,7 @@ Without that I don't how to speak to the Director :-(\n"), configfile); memset(&jcr, 0, sizeof(jcr)); -#ifdef HAVE_WIN32 WSA_Init(); /* Initialize Windows sockets */ -#endif if (ndir > 1) { struct sockaddr_in client_addr; @@ -399,7 +397,8 @@ try_again: } UnlockRes(); if (get_cmd(stdin, _("Select Director: "), UA_sock, 600) < 0) { - return 1; + WSACleanup(); /* Cleanup Windows sockets */ + return 1; } item = atoi(UA_sock->msg); if (item < 0 || item > ndir) { @@ -470,6 +469,8 @@ try_again: /* Cleanup and then exit */ static void terminate_console(int sig) { + WSACleanup(); /* Cleanup Windows sockets */ + static bool already_here = false; if (already_here) { /* avoid recursive temination problems */ diff --git a/bacula/src/filed/win32/winmain.cpp b/bacula/src/filed/win32/winmain.cpp index d1967905f4..625146ae20 100755 --- a/bacula/src/filed/win32/winmain.cpp +++ b/bacula/src/filed/win32/winmain.cpp @@ -302,9 +302,7 @@ int BaculaAppMain() { /* DWORD dwThreadID; */ pthread_t tid; -#ifdef HAVE_WIN32 WSA_Init(); -#endif HINSTANCE hLib = LoadLibrary("KERNEL32.DLL"); if (hLib) { p_GetFileAttributesEx = (t_GetFileAttributesEx) @@ -355,5 +353,6 @@ int BaculaAppMain() /* Call the "real" Bacula */ BaculaMain(num_command_args, command_args); PostQuitMessage(0); + WSACleanup(); _exit(0); } -- 2.39.5