GNU bug report logs - #23615
25.1.50; Which platforms can safely use getsockopt(,,SO_ERROR,,)?

Previous Next

Package: emacs;

Reported by: Ken Brown <kbrown <at> cornell.edu>

Date: Wed, 25 May 2016 00:27:02 UTC

Severity: wishlist

Found in version 25.1.50

Done: Ken Brown <kbrown <at> cornell.edu>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Ken Brown <kbrown <at> cornell.edu>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 23615 <at> debbugs.gnu.org
Subject: bug#23615: 25.1.50; Which platforms can safely use getsockopt(,,SO_ERROR,,)?
Date: Sat, 28 May 2016 13:18:27 -0400
On 5/28/2016 8:57 AM, Eli Zaretskii wrote:
>> From: Ken Brown <kbrown <at> cornell.edu>

>> Test program attached.  It simulates the situation of bug 23606 (before
>> the bug was fixed).  Here's what happens on Cygwin:
>>
>> $ gcc -o socket_test socket_test.c
>>
>> $ ./socket_test.exe
>> Server listening on port 50176.
>> Attempting client connection...failure: Connection refused.
>
> With MinGW, I get this instead:
>
>   D:\usr\eli\data>socket_test
>   Server listening on port 2213.
>   Attempting client connection...success.
>
> Do we have to have a failure in this case?  Or is the above a valid
> outcome?

It's a valid outcome.  I think the reason the connection is refused on 
Cygwin (and apparently on RHEL 7.2) is that the first addrinfo structure 
returned by getaddrinfo has an IPv6 address.  There's no reason to 
expect this to happen on all platforms.

> Of course, I needed to hack the code quite a lot to get it compile on
> MS-Windows; the result is attached below.  Maybe I broke the code
> while doing that?

No, you didn't.  I get the same results as before with your version, 
after fixing a couple of typos that don't affect the MinGW build.  (You 
forgot a semicolon at the end of line 41, and you misspelled "strerror" 
in line 126.)

> (I don't think calling 'connect' after 'listen' is supposed to work;
> on Windows it predictably fails with EINVAL, as documented on MSDN.)

I think on Posix systems it fails with EISCONN.  I put the call in 
because it's done in the code in process.c that I was imitating, but 
omitting it as you did is fine also.

Thanks for testing.

Ken




This bug report was last modified 8 years and 351 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.