libexplain  1.4.D001
Functions
libexplain/getaddrinfo_on_error.c File Reference
#include <libexplain/ac/assert.h>
#include <libexplain/ac/errno.h>
#include <libexplain/ac/netdb.h>
#include <libexplain/getaddrinfo.h>
#include <libexplain/output.h>

Go to the source code of this file.

Functions

int explain_getaddrinfo_on_error (const char *node, const char *service, const struct addrinfo *hints, struct addrinfo **res)

Function Documentation

int explain_getaddrinfo_on_error ( const char *  node,
const char *  service,
const struct addrinfo *  hints,
struct addrinfo **  res 
)

The explain_getaddrinfo_on_error function is used to call the getaddrinfo(3) system call. On failure an explanation will be printed to stderr, but it still returns.

This function is intended to be used in a fashion similar to the following example:

 if (explain_getaddrinfo_on_error(node, service, hints, res))
 {
     ...handle error
     ...error message already printed
 }
Parameters:
nodeThe node, exactly as to be passed to the getaddrinfo(3) system call.
serviceThe service, exactly as to be passed to the getaddrinfo(3) system call.
hintsThe hints, exactly as to be passed to the getaddrinfo(3) system call.
resThe res, exactly as to be passed to the getaddrinfo(3) system call.
Returns:
This function only returns on success. On failure, prints an explanation and exits, it does not return.

Definition at line 28 of file getaddrinfo_on_error.c.