-
Notifications
You must be signed in to change notification settings - Fork 8k
Open
Description
Description
I need to differentiate between different kinds of host lookup failures. getaddrinfo() includes the following return codes I am interested in: EAI_AGAIN, EAI_FAIL, EAI_FAMILY, EAI_NODATA, EAI_NONAME (and the others might be helpful for others)
Currently there is no way to get the return code.
My instinctual attempt to get the error was to try socket_last_error(), but this always returns 0 (Success).
I then took a look at the source code and the return code is not retained. All non-zero return codes just return false without storing the error code in any way.
In sockets.c:
if (getaddrinfo(ZSTR_VAL(hostname), service, &hints, &result) != 0) {
RETURN_FALSE;
}Is there any way to get the error code currently? Would new code need to be implemented to allow access to the error codes?