- * Copyright (C) 2004, 2007, 2008 Richard Kettlewell
+ * Copyright (C) 2004, 2007, 2008, 2013 Richard Kettlewell
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
switch(a->n) {
case 1:
byte_xasprintf(&name, "host * service %s", a->s[0]);
if((rc = getaddrinfo(0, a->s[0], pref, &res))) {
switch(a->n) {
case 1:
byte_xasprintf(&name, "host * service %s", a->s[0]);
if((rc = getaddrinfo(0, a->s[0], pref, &res))) {
- disorder_error(0, "getaddrinfo %s: %s", a->s[0], gai_strerror(rc));
+ disorder_error(0, "getaddrinfo %s: %s", a->s[0],
+ format_error(ec_getaddrinfo, rc, errbuf, sizeof errbuf));
byte_xasprintf(&name, "host %s service %s", a->s[0], a->s[1]);
if((rc = getaddrinfo(a->s[0], a->s[1], pref, &res))) {
disorder_error(0, "getaddrinfo %s %s: %s",
byte_xasprintf(&name, "host %s service %s", a->s[0], a->s[1]);
if((rc = getaddrinfo(a->s[0], a->s[1], pref, &res))) {
disorder_error(0, "getaddrinfo %s %s: %s",
/** @brief Format a UNIX socket address */
static inline char *format_sockaddrun(const struct sockaddr_un *sun) {
return xstrdup(sun->sun_path);
}
/** @brief Format a UNIX socket address */
static inline char *format_sockaddrun(const struct sockaddr_un *sun) {
return xstrdup(sun->sun_path);
}
return format_sockaddr4((const struct sockaddr_in *)sa);
case AF_INET6:
return format_sockaddr6((const struct sockaddr_in6 *)sa);
return format_sockaddr4((const struct sockaddr_in *)sa);
case AF_INET6:
return format_sockaddr6((const struct sockaddr_in6 *)sa);
- long p;
- int e = xstrtol(&p, port, NULL, 10);
+ e = xstrtol(&p, port, NULL, 10);
- snprintf(buffer, sizeof buffer, "%d", na->port);
+ byte_snprintf(buffer, sizeof buffer, "%d", na->port);
memset(hints, 0, sizeof hints);
hints->ai_family = na->af;
hints->ai_protocol = protocol;
hints->ai_flags = passive ? AI_PASSIVE : 0;
memset(hints, 0, sizeof hints);
hints->ai_family = na->af;
hints->ai_protocol = protocol;
hints->ai_flags = passive ? AI_PASSIVE : 0;
- snprintf(service, sizeof service, "%d", na->port);
+ byte_snprintf(service, sizeof service, "%d", na->port);
rc = getaddrinfo(na->address, service, hints, &res);
if(rc) {
disorder_error(0, "getaddrinfo %s %d: %s",
na->address ? na->address : "*",
rc = getaddrinfo(na->address, service, hints, &res);
if(rc) {
disorder_error(0, "getaddrinfo %s %d: %s",
na->address ? na->address : "*",