Boost logo

Boost Users :

From: Niall Douglas (s_sourceforge_at_[hidden])
Date: 2021-08-24 14:23:33


On 24/08/2021 14:47, Cristian Morales Vega wrote:
> On Tue, 24 Aug 2021 at 16:36, Niall Douglas via Boost-users
> <boost-users_at_[hidden]> wrote:
>>
>> On 24/08/2021 13:57, Nils Frielinghaus via Boost-users wrote:
>>
>>> What can be easily demonstrated though, is, that the
>> translate_addrinfo_error function converts EAI_SYSTEM with errno=0
 (which is triggered by the
>> above set-up) into a Boost error code that shows success.
>>> So this program will output "Success".
>>
>> This is a long standing design quirk of error_code which we have fixed
>> in proposed status_code, which is hoped to supersede error_code in a
>> future C++ standard.
>
> I think you are talking about a different problem.
> The issue here is that
>
 https://pubs.opengroup.org/onlinepubs/9699919799/functions/getaddrinfo.html
> says "[EAI_SYSTEM] A system error occurred; the error code can be
> found in errno." and apparently there is a implementation not
> honouring this contract. This is happening way before there is any
> error_code.

In proposed status_code we supply a getaddrinfo_code, so getaddrinfo
codes get their own status code domain. EAI_SYSTEM compares equal to
errc::resource_unavailable_try_again:

https://github.com/ned14/status-code/blob/master/include/getaddrinfo_code.hpp

One can't make a functional getaddrinfo_code for error_code because one
of the getaddrinfo() code values is zero, which error_code treats as
success. This is the quirk which we fixed.

Niall


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net