Author: cazfi Date: Fri Jan 29 09:02:23 2016 New Revision: 31673 URL: http://svn.gna.org/viewcvs/freeciv?rev=31673&view=rev Log: Always use Windows-specific server launching code on the client when WIN32_NATIVE is set, no matter if HAVE_WOKING_FORK is also set.
See patch #6869 Modified: branches/S2_6/client/connectdlg_common.c Modified: branches/S2_6/client/connectdlg_common.c URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_6/client/connectdlg_common.c?rev=31673&r1=31672&r2=31673&view=diff ============================================================================== --- branches/S2_6/client/connectdlg_common.c (original) +++ branches/S2_6/client/connectdlg_common.c Fri Jan 29 09:02:23 2016 @@ -66,7 +66,13 @@ #define WAIT_BETWEEN_TRIES 100000 /* usecs */ #define NUMBER_OF_TRIES 500 -#ifdef HAVE_WORKING_FORK +#if defined(HAVE_WORKING_FORK) && !defined(WIN32_NATIVE) +/* We are yet to see WIN32_NATIVE setup where even HAVE_WORKING_FORK would + * mean fork() that actually works for us. */ +#define HAVE_USABLE_FORK +#endif + +#ifdef HAVE_USABLE_FORK static pid_t server_pid = -1; #elif WIN32_NATIVE HANDLE server_process = INVALID_HANDLE_VALUE; @@ -108,7 +114,7 @@ **************************************************************************/ bool is_server_running(void) { -#ifdef HAVE_WORKING_FORK +#ifdef HAVE_USABLE_FORK return (server_pid > 0); #elif WIN32_NATIVE return (server_process != INVALID_HANDLE_VALUE); @@ -149,7 +155,7 @@ * it could potentially be called when we're connected to an unowned * server. In this case we don't want to kill it. */ send_chat("/quit"); -#ifdef HAVE_WORKING_FORK +#ifdef HAVE_USABLE_FORK server_pid = -1; #elif WIN32_NATIVE server_process = INVALID_HANDLE_VALUE; @@ -159,7 +165,7 @@ /* Either we already disconnected, or we didn't get control of the * server. In either case, the only thing to do is a "hard" kill of * the server. */ -#ifdef HAVE_WORKING_FORK +#ifdef HAVE_USABLE_FORK kill(server_pid, SIGTERM); waitpid(server_pid, NULL, WUNTRACED); server_pid = -1; @@ -171,7 +177,7 @@ } server_process = INVALID_HANDLE_VALUE; loghandle = INVALID_HANDLE_VALUE; -#endif /* WIN32_NATIVE || HAVE_WORKING_FORK */ +#endif /* WIN32_NATIVE || HAVE_USABLE_FORK */ } } client_has_hack = FALSE; @@ -183,13 +189,13 @@ *****************************************************************/ bool client_start_server(void) { -#if !defined(HAVE_WORKING_FORK) && !defined(WIN32_NATIVE) +#if !defined(HAVE_USABLE_FORK) && !defined(WIN32_NATIVE) /* Can't do much without fork */ return FALSE; -#else /* HAVE_WORKING_FORK || WIN32_NATIVE */ +#else /* HAVE_USABLE_FORK || WIN32_NATIVE */ char buf[512]; int connect_tries = 0; -#if !defined(HAVE_WORKING_FORK) +#if !defined(HAVE_USABLE_FORK) /* Above also implies that this is WIN32_NATIVE -> * Win32 that can't use fork() */ STARTUPINFO si; @@ -209,7 +215,7 @@ char savefilecmdline[512]; char savescmdline[512]; char scenscmdline[512]; -#endif /* !HAVE_WORKING_FORK -> WIN32_NATIVE */ +#endif /* !HAVE_USABLE_FORK -> WIN32_NATIVE */ #ifdef FREECIV_IPV6_SUPPORT enum fc_addr_family family = FC_ADDR_ANY; @@ -238,7 +244,7 @@ return FALSE; } -#ifdef HAVE_WORKING_FORK +#ifdef HAVE_USABLE_FORK { int argc = 0; const int max_nargs = 18; @@ -338,7 +344,7 @@ _exit(1); } } -#else /* HAVE_WORKING_FORK */ +#else /* HAVE_USABLE_FORK */ #ifdef WIN32_NATIVE if (logfile) { loghandle = CreateFile(logfile, GENERIC_WRITE, @@ -440,19 +446,19 @@ server_process = pi.hProcess; #endif /* WIN32_NATIVE */ -#endif /* HAVE_WORKING_FORK */ +#endif /* HAVE_USABLE_FORK */ /* a reasonable number of tries */ while (connect_to_server(user_name, "localhost", internal_server_port, buf, sizeof(buf)) == -1) { fc_usleep(WAIT_BETWEEN_TRIES); -#ifdef HAVE_WORKING_FORK +#ifdef HAVE_USABLE_FORK #ifndef WIN32_NATIVE if (waitpid(server_pid, NULL, WNOHANG) != 0) { break; } #endif /* WIN32_NATIVE */ -#endif /* HAVE_WORKING_FORK */ +#endif /* HAVE_USABLE_FORK */ if (connect_tries++ > NUMBER_OF_TRIES) { log_error("Last error from connect attempts: '%s'", buf); break; @@ -508,7 +514,7 @@ } return TRUE; -#endif /* HAVE_WORKING_FORK || WIN32_NATIVE */ +#endif /* HAVE_USABLE_FORK || WIN32_NATIVE */ } /************************************************************************* _______________________________________________ Freeciv-commits mailing list Freeciv-commits@gna.org https://mail.gna.org/listinfo/freeciv-commits