1
0
Fork 0
mirror of https://gitlab.com/sortix/sortix.git synced 2023-02-13 20:55:38 -05:00

Fix getaddrinfo error reporting.

This commit is contained in:
Jonas 'Sortie' Termansen 2015-12-19 04:02:35 +01:00
parent 22351d7f72
commit 8f1353eb94
2 changed files with 18 additions and 8 deletions

View file

@ -1,6 +1,6 @@
/*******************************************************************************
Copyright(C) Jonas 'Sortie' Termansen 2013.
Copyright(C) Jonas 'Sortie' Termansen 2013, 2015.
This file is part of the Sortix C Library.
@ -23,12 +23,23 @@
*******************************************************************************/
#include <netdb.h>
#include <stdio.h>
#include <stdlib.h>
extern "C" const char* gai_strerror(int)
extern "C" const char* gai_strerror(int err)
{
fprintf(stderr, "%s is not implemented, aborting.\n", __func__);
abort();
switch ( err )
{
case EAI_AGAIN: return "Try again";
case EAI_BADFLAGS: return "Invalid flags";
case EAI_FAIL: return "Non-recoverable error";
case EAI_FAMILY: return "Unrecognized address family or invalid length";
case EAI_MEMORY: return "Out of memory";
case EAI_NONAME: return "Name does not resolve";
case EAI_SERVICE: return "Unrecognized service";
case EAI_SOCKTYPE: return "Unrecognized socket type";
case EAI_SYSTEM: return "System error";
case EAI_OVERFLOW: return "Overflow";
}
return "Unknown error";
}

View file

@ -1,6 +1,6 @@
/*******************************************************************************
Copyright(C) Jonas 'Sortie' Termansen 2013.
Copyright(C) Jonas 'Sortie' Termansen 2013, 2015.
This file is part of the Sortix C Library.
@ -31,6 +31,5 @@ extern "C" int getaddrinfo(const char* restrict, const char* restrict,
const struct addrinfo* restrict,
struct addrinfo** restrict)
{
fprintf(stderr, "%s is not implemented, aborting.\n", __func__);
abort();
return EAI_NONAME;
}