wsa_error_to_errno() calls abort() on WSAEACCES
Description
Environment
Windows Server 2008 HPC Edition SP2 64-bit
Attachments
1
- 20 May 2012, 03:06 AM
Activity
Show:
Steven McCoy June 19, 2012 at 6:17 PM
Get there eventually :/
Michael Douglass June 19, 2012 at 5:46 PM
You did not include ENETRESET in this last patch. All other errors have gone away.
Michael Douglass June 19, 2012 at 5:17 PM
Steven: I think that's a pretty elegant solution to the problem.
I also agree that leaving out some of the WSA error codes WILL, at some point, cause other similar issues to this bug; so it's a good idea to have all of them in there as you have done.
Steven McCoy June 18, 2012 at 9:16 PM
Ok 3 × pull requests sent again.
Steven McCoy June 18, 2012 at 9:08 PMEdited
Ok ZeroMQ has a mechanism for this, include/zmq.h has fallbacks:
Calling zmq_bind(soc, "tcp://*:62053") (and several other port numbers) results in WinSock error WSAEACCES ("Permission denied") at tcp_listener.cpp:82, which is not properly handled by wsa_error_to_errno(). It calls wsa_assert(false), which aborts the whole application.
The preferred solution is to return EACCES instead of calling wsa_assert(false).
The fix is especially useful for an application that tries to bind to a free TCP port in the dynamic port range (49152–65535 or some portion of it) by calling zmq_bind() in a try-catch block, catching errors of type EADDRINUSE and EACCES and moving to the next port upon such an error.