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.
This commit is contained in:
Paul Eggert 2016-06-09 23:11:40 -07:00
parent 560202f675
commit 07b77b8ee0
3 changed files with 5 additions and 5 deletions

View file

@ -156,7 +156,6 @@ HAVE_GETLOADAVG
HAVE_GETOPT_H
HAVE_GETOPT_LONG_ONLY
HAVE_GETPAGESIZE
HAVE_GETPEERNAME
HAVE_GETPT
HAVE_GETPWENT
HAVE_GETRLIMIT

View file

@ -3848,7 +3848,7 @@ lrand48 random rint \
select getpagesize setlocale newlocale \
getrlimit setrlimit shutdown \
pthread_sigmask strsignal setitimer \
sendto recvfrom getsockname getpeername getifaddrs freeifaddrs \
sendto recvfrom getsockname getifaddrs freeifaddrs \
gai_strerror sync \
getpwent endpwent getgrent endgrent \
cfmakeraw cfsetspeed copysign __executable_start log2)

View file

@ -5492,15 +5492,16 @@ wait_reading_process_output (intmax_t time_limit, int nsecs, int read_kbd,
p = XPROCESS (proc);
#ifdef GNU_LINUX
/* getsockopt(,,SO_ERROR,,) is said to hang on some systems.
So only use it on systems where it is known to work. */
#ifndef WINDOWSNT
{
socklen_t xlen = sizeof (xerrno);
if (getsockopt (channel, SOL_SOCKET, SO_ERROR, &xerrno, &xlen))
xerrno = errno;
}
#else
/* On MS-Windows, getsockopt clears the error for the
entire process, which may not be the right thing; see
w32.c. Use getpeername instead. */
{
struct sockaddr pname;
socklen_t pnamelen = sizeof (pname);