comparison lib-src/emacsclient.c @ 73657:4b7e3d203c5c

(initialize_sockets): Don't initialize Winsock more than once.
author Juanma Barranquero <lekktu@gmail.com>
date Fri, 03 Nov 2006 16:24:53 +0000
parents 7af864af10b6
children bcb5c0f9a466
comparison
equal deleted inserted replaced
73656:1f2ec9976631 73657:4b7e3d203c5c
388 WSACleanup (); 388 WSACleanup ();
389 } 389 }
390 390
391 void initialize_sockets () 391 void initialize_sockets ()
392 { 392 {
393 static done = FALSE;
393 WSADATA wsaData; 394 WSADATA wsaData;
395
396 if (done) return;
394 397
395 /* Initialize the WinSock2 library. */ 398 /* Initialize the WinSock2 library. */
396 if (WSAStartup (MAKEWORD (2, 0), &wsaData)) 399 if (WSAStartup (MAKEWORD (2, 0), &wsaData))
397 { 400 {
398 fprintf (stderr, "%s: error initializing WinSock2", progname); 401 fprintf (stderr, "%s: error initializing WinSock2", progname);
399 exit (EXIT_FAILURE); 402 exit (EXIT_FAILURE);
400 } 403 }
401 404
402 atexit (close_winsock); 405 atexit (close_winsock);
406 done = TRUE;
403 } 407 }
404 #endif /* WINDOWSNT */ 408 #endif /* WINDOWSNT */
405 409
406 /* 410 /*
407 * Read the information needed to set up a TCP comm channel with 411 * Read the information needed to set up a TCP comm channel with