# HG changeset patch # User Chong Yidong # Date 1288900468 14400 # Node ID e7a9eb3aa4ac2f2a686b441a21acb059ee8c7f4a # Parent 5a8705defdf90bef30d9a5faefe22f3fea7cd47b Backport r99752 from trunk diff -r 5a8705defdf9 -r e7a9eb3aa4ac src/ChangeLog --- a/src/ChangeLog Thu Nov 04 15:54:14 2010 -0400 +++ b/src/ChangeLog Thu Nov 04 15:54:28 2010 -0400 @@ -1,3 +1,8 @@ +2010-03-27 Chong Yidong + + * process.c (Fmake_network_process): Don't apply Bug#5173 fix for + Windows. + 2010-03-25 YAMAMOTO Mitsuharu * process.c (Fmake_network_process): Don't call turn_on_atimers around diff -r 5a8705defdf9 -r e7a9eb3aa4ac src/process.c --- a/src/process.c Thu Nov 04 15:54:14 2010 -0400 +++ b/src/process.c Thu Nov 04 15:54:28 2010 -0400 @@ -3573,6 +3573,8 @@ { int optn, optbits; + retry_connect: + s = socket (lres->ai_family, lres->ai_socktype, lres->ai_protocol); if (s < 0) { @@ -3675,12 +3677,14 @@ #endif #endif #endif + +#ifndef WINDOWSNT if (xerrno == EINTR) { /* Unlike most other syscalls connect() cannot be called again. (That would return EALREADY.) The proper way to wait for completion is select(). */ - int sc; + int sc, len; SELECT_TYPE fdset; retry_select: FD_ZERO (&fdset); @@ -3690,23 +3694,23 @@ (EMACS_TIME *)0); if (sc == -1) { - if (errno == EINTR) + if (errno == EINTR) goto retry_select; - else + else report_file_error ("select failed", Qnil); } eassert (sc > 0); - { - int len = sizeof xerrno; - eassert (FD_ISSET (s, &fdset)); - if (getsockopt (s, SOL_SOCKET, SO_ERROR, &xerrno, &len) == -1) - report_file_error ("getsockopt failed", Qnil); - if (xerrno != 0) - errno = xerrno, report_file_error ("error during connect", Qnil); - else - break; - } + + len = sizeof xerrno; + eassert (FD_ISSET (s, &fdset)); + if (getsockopt (s, SOL_SOCKET, SO_ERROR, &xerrno, &len) == -1) + report_file_error ("getsockopt failed", Qnil); + if (xerrno) + errno = xerrno, report_file_error ("error during connect", Qnil); + else + break; } +#endif /* !WINDOWSNT */ immediate_quit = 0; @@ -3714,6 +3718,11 @@ specpdl_ptr = specpdl + count1; emacs_close (s); s = -1; + +#ifdef WINDOWSNT + if (xerrno == EINTR) + goto retry_connect; +#endif } if (s >= 0)