diff options
| author | Chong Yidong | 2010-11-04 15:54:28 -0400 |
|---|---|---|
| committer | Chong Yidong | 2010-11-04 15:54:28 -0400 |
| commit | 184765cc7a4f8c0ff5e7522ee4e1584b441b742f (patch) | |
| tree | 95357498bec91c6374a55d83a5eff60f5d80b725 /src/process.c | |
| parent | bd80a88673b755ccf9d850b907e65fec5308e6b4 (diff) | |
| download | emacs-184765cc7a4f8c0ff5e7522ee4e1584b441b742f.tar.gz emacs-184765cc7a4f8c0ff5e7522ee4e1584b441b742f.zip | |
Backport 2010-03-27T00:45:32Z!cyd@stupidchicken.com from trunk
Diffstat (limited to 'src/process.c')
| -rw-r--r-- | src/process.c | 35 |
1 files changed, 22 insertions, 13 deletions
diff --git a/src/process.c b/src/process.c index e3622c79386..df30adcf0be 100644 --- a/src/process.c +++ b/src/process.c | |||
| @@ -3573,6 +3573,8 @@ usage: (make-network-process &rest ARGS) */) | |||
| 3573 | { | 3573 | { |
| 3574 | int optn, optbits; | 3574 | int optn, optbits; |
| 3575 | 3575 | ||
| 3576 | retry_connect: | ||
| 3577 | |||
| 3576 | s = socket (lres->ai_family, lres->ai_socktype, lres->ai_protocol); | 3578 | s = socket (lres->ai_family, lres->ai_socktype, lres->ai_protocol); |
| 3577 | if (s < 0) | 3579 | if (s < 0) |
| 3578 | { | 3580 | { |
| @@ -3675,12 +3677,14 @@ usage: (make-network-process &rest ARGS) */) | |||
| 3675 | #endif | 3677 | #endif |
| 3676 | #endif | 3678 | #endif |
| 3677 | #endif | 3679 | #endif |
| 3680 | |||
| 3681 | #ifndef WINDOWSNT | ||
| 3678 | if (xerrno == EINTR) | 3682 | if (xerrno == EINTR) |
| 3679 | { | 3683 | { |
| 3680 | /* Unlike most other syscalls connect() cannot be called | 3684 | /* Unlike most other syscalls connect() cannot be called |
| 3681 | again. (That would return EALREADY.) The proper way to | 3685 | again. (That would return EALREADY.) The proper way to |
| 3682 | wait for completion is select(). */ | 3686 | wait for completion is select(). */ |
| 3683 | int sc; | 3687 | int sc, len; |
| 3684 | SELECT_TYPE fdset; | 3688 | SELECT_TYPE fdset; |
| 3685 | retry_select: | 3689 | retry_select: |
| 3686 | FD_ZERO (&fdset); | 3690 | FD_ZERO (&fdset); |
| @@ -3690,23 +3694,23 @@ usage: (make-network-process &rest ARGS) */) | |||
| 3690 | (EMACS_TIME *)0); | 3694 | (EMACS_TIME *)0); |
| 3691 | if (sc == -1) | 3695 | if (sc == -1) |
| 3692 | { | 3696 | { |
| 3693 | if (errno == EINTR) | 3697 | if (errno == EINTR) |
| 3694 | goto retry_select; | 3698 | goto retry_select; |
| 3695 | else | 3699 | else |
| 3696 | report_file_error ("select failed", Qnil); | 3700 | report_file_error ("select failed", Qnil); |
| 3697 | } | 3701 | } |
| 3698 | eassert (sc > 0); | 3702 | eassert (sc > 0); |
| 3699 | { | 3703 | |
| 3700 | int len = sizeof xerrno; | 3704 | len = sizeof xerrno; |
| 3701 | eassert (FD_ISSET (s, &fdset)); | 3705 | eassert (FD_ISSET (s, &fdset)); |
| 3702 | if (getsockopt (s, SOL_SOCKET, SO_ERROR, &xerrno, &len) == -1) | 3706 | if (getsockopt (s, SOL_SOCKET, SO_ERROR, &xerrno, &len) == -1) |
| 3703 | report_file_error ("getsockopt failed", Qnil); | 3707 | report_file_error ("getsockopt failed", Qnil); |
| 3704 | if (xerrno != 0) | 3708 | if (xerrno) |
| 3705 | errno = xerrno, report_file_error ("error during connect", Qnil); | 3709 | errno = xerrno, report_file_error ("error during connect", Qnil); |
| 3706 | else | 3710 | else |
| 3707 | break; | 3711 | break; |
| 3708 | } | ||
| 3709 | } | 3712 | } |
| 3713 | #endif /* !WINDOWSNT */ | ||
| 3710 | 3714 | ||
| 3711 | immediate_quit = 0; | 3715 | immediate_quit = 0; |
| 3712 | 3716 | ||
| @@ -3714,6 +3718,11 @@ usage: (make-network-process &rest ARGS) */) | |||
| 3714 | specpdl_ptr = specpdl + count1; | 3718 | specpdl_ptr = specpdl + count1; |
| 3715 | emacs_close (s); | 3719 | emacs_close (s); |
| 3716 | s = -1; | 3720 | s = -1; |
| 3721 | |||
| 3722 | #ifdef WINDOWSNT | ||
| 3723 | if (xerrno == EINTR) | ||
| 3724 | goto retry_connect; | ||
| 3725 | #endif | ||
| 3717 | } | 3726 | } |
| 3718 | 3727 | ||
| 3719 | if (s >= 0) | 3728 | if (s >= 0) |