diff options
| author | Chong Yidong | 2010-11-04 15:56:50 -0400 |
|---|---|---|
| committer | Chong Yidong | 2010-11-04 15:56:50 -0400 |
| commit | 055c91d4329071935d2f521e54b5fa0c998a84d3 (patch) | |
| tree | 00c2b6dd114f42e9228d0d48c81347cbeddd4a00 /src | |
| parent | 68ae6cda9e2a55c23d9680953bf9a402616e6901 (diff) | |
| parent | 184765cc7a4f8c0ff5e7522ee4e1584b441b742f (diff) | |
| download | emacs-055c91d4329071935d2f521e54b5fa0c998a84d3.tar.gz emacs-055c91d4329071935d2f521e54b5fa0c998a84d3.zip | |
Backport fix for Bug#5723 from trunk.
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 15 | ||||
| -rw-r--r-- | src/process.c | 50 |
2 files changed, 51 insertions, 14 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index 077385d6f6c..b803582e5f6 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,3 +1,18 @@ | |||
| 1 | 2010-11-04 Chong Yidong <cyd@stupidchicken.com> | ||
| 2 | |||
| 3 | * process.c (Fmake_network_process): Don't apply Bug#5173 fix for | ||
| 4 | Windows. | ||
| 5 | |||
| 6 | 2010-11-04 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp> | ||
| 7 | |||
| 8 | * process.c (Fmake_network_process): Don't call turn_on_atimers around | ||
| 9 | `connect' (Bug#5723). | ||
| 10 | |||
| 11 | 2010-11-04 Helmut Eller <eller.helmut@gmail.com> | ||
| 12 | |||
| 13 | * process.c (Fmake_network_process): Call `select' for interrupted | ||
| 14 | `connect' rather than creating new socket (Bug#5173). | ||
| 15 | |||
| 1 | 2010-11-04 Kenichi Handa <handa@m17n.org> | 16 | 2010-11-04 Kenichi Handa <handa@m17n.org> |
| 2 | 17 | ||
| 3 | * font.c (font_delete_unmatched): Check Vface_ignored_fonts. | 18 | * font.c (font_delete_unmatched): Check Vface_ignored_fonts. |
diff --git a/src/process.c b/src/process.c index 567300e2f64..df30adcf0be 100644 --- a/src/process.c +++ b/src/process.c | |||
| @@ -3656,23 +3656,9 @@ usage: (make-network-process &rest ARGS) */) | |||
| 3656 | immediate_quit = 1; | 3656 | immediate_quit = 1; |
| 3657 | QUIT; | 3657 | QUIT; |
| 3658 | 3658 | ||
| 3659 | /* This turns off all alarm-based interrupts; the | ||
| 3660 | bind_polling_period call above doesn't always turn all the | ||
| 3661 | short-interval ones off, especially if interrupt_input is | ||
| 3662 | set. | ||
| 3663 | |||
| 3664 | It'd be nice to be able to control the connect timeout | ||
| 3665 | though. Would non-blocking connect calls be portable? | ||
| 3666 | |||
| 3667 | This used to be conditioned by HAVE_GETADDRINFO. Why? */ | ||
| 3668 | |||
| 3669 | turn_on_atimers (0); | ||
| 3670 | |||
| 3671 | ret = connect (s, lres->ai_addr, lres->ai_addrlen); | 3659 | ret = connect (s, lres->ai_addr, lres->ai_addrlen); |
| 3672 | xerrno = errno; | 3660 | xerrno = errno; |
| 3673 | 3661 | ||
| 3674 | turn_on_atimers (1); | ||
| 3675 | |||
| 3676 | if (ret == 0 || xerrno == EISCONN) | 3662 | if (ret == 0 || xerrno == EISCONN) |
| 3677 | { | 3663 | { |
| 3678 | /* The unwind-protect will be discarded afterwards. | 3664 | /* The unwind-protect will be discarded afterwards. |
| @@ -3692,6 +3678,40 @@ usage: (make-network-process &rest ARGS) */) | |||
| 3692 | #endif | 3678 | #endif |
| 3693 | #endif | 3679 | #endif |
| 3694 | 3680 | ||
| 3681 | #ifndef WINDOWSNT | ||
| 3682 | if (xerrno == EINTR) | ||
| 3683 | { | ||
| 3684 | /* Unlike most other syscalls connect() cannot be called | ||
| 3685 | again. (That would return EALREADY.) The proper way to | ||
| 3686 | wait for completion is select(). */ | ||
| 3687 | int sc, len; | ||
| 3688 | SELECT_TYPE fdset; | ||
| 3689 | retry_select: | ||
| 3690 | FD_ZERO (&fdset); | ||
| 3691 | FD_SET (s, &fdset); | ||
| 3692 | QUIT; | ||
| 3693 | sc = select (s + 1, (SELECT_TYPE *)0, &fdset, (SELECT_TYPE *)0, | ||
| 3694 | (EMACS_TIME *)0); | ||
| 3695 | if (sc == -1) | ||
| 3696 | { | ||
| 3697 | if (errno == EINTR) | ||
| 3698 | goto retry_select; | ||
| 3699 | else | ||
| 3700 | report_file_error ("select failed", Qnil); | ||
| 3701 | } | ||
| 3702 | eassert (sc > 0); | ||
| 3703 | |||
| 3704 | len = sizeof xerrno; | ||
| 3705 | eassert (FD_ISSET (s, &fdset)); | ||
| 3706 | if (getsockopt (s, SOL_SOCKET, SO_ERROR, &xerrno, &len) == -1) | ||
| 3707 | report_file_error ("getsockopt failed", Qnil); | ||
| 3708 | if (xerrno) | ||
| 3709 | errno = xerrno, report_file_error ("error during connect", Qnil); | ||
| 3710 | else | ||
| 3711 | break; | ||
| 3712 | } | ||
| 3713 | #endif /* !WINDOWSNT */ | ||
| 3714 | |||
| 3695 | immediate_quit = 0; | 3715 | immediate_quit = 0; |
| 3696 | 3716 | ||
| 3697 | /* Discard the unwind protect closing S. */ | 3717 | /* Discard the unwind protect closing S. */ |
| @@ -3699,8 +3719,10 @@ usage: (make-network-process &rest ARGS) */) | |||
| 3699 | emacs_close (s); | 3719 | emacs_close (s); |
| 3700 | s = -1; | 3720 | s = -1; |
| 3701 | 3721 | ||
| 3722 | #ifdef WINDOWSNT | ||
| 3702 | if (xerrno == EINTR) | 3723 | if (xerrno == EINTR) |
| 3703 | goto retry_connect; | 3724 | goto retry_connect; |
| 3725 | #endif | ||
| 3704 | } | 3726 | } |
| 3705 | 3727 | ||
| 3706 | if (s >= 0) | 3728 | if (s >= 0) |