diff options
| author | Paul Eggert | 2016-06-09 23:11:40 -0700 |
|---|---|---|
| committer | Paul Eggert | 2016-06-09 23:12:07 -0700 |
| commit | 07b77b8ee02192a6d60c87002bb89a1eaee1aecc (patch) | |
| tree | f7a981aa0e8bbe825d7c748bc08880db9d7817ee | |
| parent | 560202f67513327f5b262e01ebc709ab6855d6f6 (diff) | |
| download | emacs-07b77b8ee02192a6d60c87002bb89a1eaee1aecc.tar.gz emacs-07b77b8ee02192a6d60c87002bb89a1eaee1aecc.zip | |
Prefer getsockopt to getpeername on non-MS-Windows
* admin/CPP-DEFINES: Remove HAVE_GETPEERNAME.
* configure.ac: Don’t check for getpeername.
* src/process.c (wait_reading_process_output) [!WINDOWSNT]:
Use getsockopt even if not GNU/Linux, as the platforms where
getsockopt used to hang are no doubt long dead.
| -rw-r--r-- | admin/CPP-DEFINES | 1 | ||||
| -rw-r--r-- | configure.ac | 2 | ||||
| -rw-r--r-- | src/process.c | 7 |
3 files changed, 5 insertions, 5 deletions
diff --git a/admin/CPP-DEFINES b/admin/CPP-DEFINES index d9df152bff5..c7ec8ce6fed 100644 --- a/admin/CPP-DEFINES +++ b/admin/CPP-DEFINES | |||
| @@ -156,7 +156,6 @@ HAVE_GETLOADAVG | |||
| 156 | HAVE_GETOPT_H | 156 | HAVE_GETOPT_H |
| 157 | HAVE_GETOPT_LONG_ONLY | 157 | HAVE_GETOPT_LONG_ONLY |
| 158 | HAVE_GETPAGESIZE | 158 | HAVE_GETPAGESIZE |
| 159 | HAVE_GETPEERNAME | ||
| 160 | HAVE_GETPT | 159 | HAVE_GETPT |
| 161 | HAVE_GETPWENT | 160 | HAVE_GETPWENT |
| 162 | HAVE_GETRLIMIT | 161 | HAVE_GETRLIMIT |
diff --git a/configure.ac b/configure.ac index a367582f2ab..069a7260e88 100644 --- a/configure.ac +++ b/configure.ac | |||
| @@ -3848,7 +3848,7 @@ lrand48 random rint \ | |||
| 3848 | select getpagesize setlocale newlocale \ | 3848 | select getpagesize setlocale newlocale \ |
| 3849 | getrlimit setrlimit shutdown \ | 3849 | getrlimit setrlimit shutdown \ |
| 3850 | pthread_sigmask strsignal setitimer \ | 3850 | pthread_sigmask strsignal setitimer \ |
| 3851 | sendto recvfrom getsockname getpeername getifaddrs freeifaddrs \ | 3851 | sendto recvfrom getsockname getifaddrs freeifaddrs \ |
| 3852 | gai_strerror sync \ | 3852 | gai_strerror sync \ |
| 3853 | getpwent endpwent getgrent endgrent \ | 3853 | getpwent endpwent getgrent endgrent \ |
| 3854 | cfmakeraw cfsetspeed copysign __executable_start log2) | 3854 | cfmakeraw cfsetspeed copysign __executable_start log2) |
diff --git a/src/process.c b/src/process.c index 5e06ccccac8..4d287d8cc51 100644 --- a/src/process.c +++ b/src/process.c | |||
| @@ -5492,15 +5492,16 @@ wait_reading_process_output (intmax_t time_limit, int nsecs, int read_kbd, | |||
| 5492 | 5492 | ||
| 5493 | p = XPROCESS (proc); | 5493 | p = XPROCESS (proc); |
| 5494 | 5494 | ||
| 5495 | #ifdef GNU_LINUX | 5495 | #ifndef WINDOWSNT |
| 5496 | /* getsockopt(,,SO_ERROR,,) is said to hang on some systems. | ||
| 5497 | So only use it on systems where it is known to work. */ | ||
| 5498 | { | 5496 | { |
| 5499 | socklen_t xlen = sizeof (xerrno); | 5497 | socklen_t xlen = sizeof (xerrno); |
| 5500 | if (getsockopt (channel, SOL_SOCKET, SO_ERROR, &xerrno, &xlen)) | 5498 | if (getsockopt (channel, SOL_SOCKET, SO_ERROR, &xerrno, &xlen)) |
| 5501 | xerrno = errno; | 5499 | xerrno = errno; |
| 5502 | } | 5500 | } |
| 5503 | #else | 5501 | #else |
| 5502 | /* On MS-Windows, getsockopt clears the error for the | ||
| 5503 | entire process, which may not be the right thing; see | ||
| 5504 | w32.c. Use getpeername instead. */ | ||
| 5504 | { | 5505 | { |
| 5505 | struct sockaddr pname; | 5506 | struct sockaddr pname; |
| 5506 | socklen_t pnamelen = sizeof (pname); | 5507 | socklen_t pnamelen = sizeof (pname); |