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


Message #29 received at 23615 <at> debbugs.gnu.org (full text, mbox):

From: Ken Brown <kbrown <at> cornell.edu>
To: Paul Eggert <eggert <at> cs.ucla.edu>
Cc: 23615 <at> debbugs.gnu.org
Subject: Re: bug#23615: 25.1.50; Which platforms can safely use
 getsockopt(,,SO_ERROR,,)?
Date: Thu, 2 Jun 2016 13:55:14 -0400

On 6/2/2016 1:17 PM, Ken Brown wrote:
> On 6/2/2016 12:00 PM, Paul Eggert wrote:
>> On Solaris 10 on a host with only IPv4 configured, socket_test.c fails
>> with the diagnostic "Can't start server." 'truss' says connect(3,
>> 0x00021EE8, 16, SOV_DEFAULT) failed with errno == EOPNOTSUPP.
>>
>> On Solaris 11 with both IPv4 and IPv6, the same symptoms except errno ==
>> EADDRNOTAVAIL.
>
> Thanks for testing.  This means that my test program is not portable
> enough to answer the question in the subject; the failure occurred
> before the program reached the getsockopt call.  I'll see if I can fix
> that.

I wonder if the problem was calling 'connect' after calling 'listen'. 
Eli pointed out that this doesn't work on MS-Windows, and in any case I 
can't see why it would ever be needed.  (I only did it because the code 
in process.c that I was imitating did it.)

Does the following help?

--- socket_test.c~      2016-05-25 21:27:46.000000000 -0400
+++ socket_test.c       2016-06-02 13:47:52.719883900 -0400
@@ -122,6 +122,7 @@
            return -1;
          }
          *pservice = ntohs (sa.sin_port);
+         ret = 0;
        }
       else
        /* Nonblocking client.  */
@@ -132,8 +133,8 @@
              s = -1;
              continue;
            }
+         ret = connect (s, rp->ai_addr, rp->ai_addrlen);
        }
-      ret = connect (s, rp->ai_addr, rp->ai_addrlen);
       if (ret == 0 || errno == EISCONN)
        break;
       if (!server && errno == EINPROGRESS)





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.