diff --git a/tools/nut-scanner/scan_nut.c b/tools/nut-scanner/scan_nut.c index 7984178fcb..eb6ca64838 100644 --- a/tools/nut-scanner/scan_nut.c +++ b/tools/nut-scanner/scan_nut.c @@ -247,11 +247,6 @@ nutscan_device_t * nutscan_scan_nut(const char* startIP, const char* stopIP, con int change_action_handler = 0; #endif struct scan_nut_arg *nut_arg; -#ifdef WIN32 - WSADATA WSAdata; - WSAStartup(2,&WSAdata); - atexit((void(*)(void))WSACleanup); -#endif #ifdef HAVE_PTHREAD # ifdef HAVE_SEMAPHORE @@ -265,7 +260,15 @@ nutscan_device_t * nutscan_scan_nut(const char* startIP, const char* stopIP, con # if (defined HAVE_PTHREAD_TRYJOIN) || (defined HAVE_SEMAPHORE) size_t max_threads_scantype = max_threads_oldnut; # endif +#endif /* HAVE_PTHREAD */ +#ifdef WIN32 + WSADATA WSAdata; + WSAStartup(2,&WSAdata); + atexit((void(*)(void))WSACleanup); +#endif + +#ifdef HAVE_PTHREAD pthread_mutex_init(&dev_mutex, NULL); # ifdef HAVE_SEMAPHORE diff --git a/tools/nut-scanner/scan_snmp.c b/tools/nut-scanner/scan_snmp.c index 31d4358667..46a5663470 100644 --- a/tools/nut-scanner/scan_snmp.c +++ b/tools/nut-scanner/scan_snmp.c @@ -1035,20 +1035,21 @@ nutscan_device_t * nutscan_scan_snmp(const char * start_ip, const char * stop_ip sem_t semaphore_scantype_inst; sem_t * semaphore_scantype = &semaphore_scantype_inst; # endif /* HAVE_SEMAPHORE */ - -# ifdef WIN32 - WSADATA WSAdata; - WSAStartup(2,&WSAdata); - atexit((void(*)(void))WSACleanup); -# endif - pthread_t thread; nutscan_thread_t * thread_array = NULL; size_t thread_count = 0, i; # if (defined HAVE_PTHREAD_TRYJOIN) || (defined HAVE_SEMAPHORE) size_t max_threads_scantype = max_threads_netsnmp; # endif +#endif /* HAVE_PTHREAD */ +#ifdef WIN32 + WSADATA WSAdata; + WSAStartup(2,&WSAdata); + atexit((void(*)(void))WSACleanup); +#endif + +#ifdef HAVE_PTHREAD pthread_mutex_init(&dev_mutex, NULL); # ifdef HAVE_SEMAPHORE