X-Git-Url: https://www.tinc-vpn.org/git/browse?a=blobdiff_plain;f=src%2Ftincctl.c;h=6e7965c291b4ff95f62575cd442ac1e9ad918216;hb=d0aa0817d2387e89555ed090d900f61c56b19caa;hp=956771f7a4d0909cb580bc4d2c5ce2b9c39e042e;hpb=57991e264202ad83e2c1b663777b358bf5573652;p=tinc diff --git a/src/tincctl.c b/src/tincctl.c index 956771f7..6e7965c2 100644 --- a/src/tincctl.c +++ b/src/tincctl.c @@ -68,10 +68,6 @@ bool netnamegiven = false; char *scriptinterpreter = NULL; char *scriptextension = ""; -#ifdef HAVE_MINGW -static struct WSAData wsa_state; -#endif - static struct option const long_options[] = { {"config", required_argument, NULL, 'c'}, {"net", required_argument, NULL, 'n'}, @@ -682,14 +678,6 @@ bool connect_tincd(bool verbose) { fclose(f); -#ifdef HAVE_MINGW - if(WSAStartup(MAKEWORD(2, 2), &wsa_state)) { - if(verbose) - fprintf(stderr, "System call `%s' failed: %s", "WSAStartup", winerror(GetLastError())); - return false; - } -#endif - #ifndef HAVE_MINGW struct sockaddr_un sa; sa.sun_family = AF_UNIX; @@ -2366,6 +2354,15 @@ int main(int argc, char *argv[]) { return 0; } +#ifdef HAVE_MINGW + static struct WSAData wsa_state; + + if(WSAStartup(MAKEWORD(2, 2), &wsa_state)) { + fprintf(stderr, "System call `%s' failed: %s", "WSAStartup", winerror(GetLastError())); + return false; + } +#endif + srand(time(NULL)); crypto_init();