]> git.sur5r.net Git - bacula/bacula/commitdiff
added WSACleanup(), corrected WSA_Init() (removed #ifdef)
authorNicolas Boichat <nicolas@boichat.ch>
Sat, 24 Apr 2004 11:33:50 +0000 (11:33 +0000)
committerNicolas Boichat <nicolas@boichat.ch>
Sat, 24 Apr 2004 11:33:50 +0000 (11:33 +0000)
git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@1289 91ce42f0-d328-0410-95d8-f526ca767f89

bacula/src/console/console.c
bacula/src/filed/win32/winmain.cpp

index d3f0fcd4e054fa00bd5568a754c1b76a87c8cbe7..89c658e551f117cbccc2757d0f79a0234f804440 100644 (file)
@@ -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 */
index d1967905f4346b7001e530357ea308b3e328c5d2..625146ae20f00592c753f3153210fc7d8406d8ca 100755 (executable)
@@ -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);
 }