Remove problems with fishd under Cygwin.

Yes, it's an awful hack, but IPC support (and fork support as well -
even FAQ mentions that, and suggests "restarting process" to solve the
problem (http://cygwin.com/faq/faq.html#faq.using.fixing-fork-failures),
but let's ignore that for now) is simply broken in Cygwin. Having to try
to do exactly same thing in Cygwin, just so perhaps it will work is a
completely normal thing (not). I love Windows.
This commit is contained in:
Konrad Borowski 2013-08-12 20:19:51 +03:00
parent e5e7da1482
commit d7c6855918

View File

@ -529,6 +529,14 @@ static bool acquire_socket_lock(const std::string &sock_name, std::string *out_l
*/
static int get_socket(void)
{
// Cygwin has random problems involving sockets. When using Cygwin,
// allow 20 attempts at making socket correctly.
#ifdef __CYGWIN__
int attempts = 0;
repeat:
attempts += 1;
#endif
int s, len, doexit = 0;
int exitcode = EXIT_FAILURE;
struct sockaddr_un local;
@ -599,6 +607,10 @@ unlock:
if (doexit)
{
// If Cygwin, only allow normal quit when made lots of attempts.
#ifdef __CYGWIN__
if (exitcode && attempts < 20) goto repeat;
#endif
exit_without_destructors(exitcode);
}