From 07b77b8ee02192a6d60c87002bb89a1eaee1aecc Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Thu, 9 Jun 2016 23:11:40 -0700 Subject: 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. --- src/process.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src') 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, 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); -- cgit v1.2.1