Introduction
Introduction Statistics Contact Development Disclaimer Help
Add true getaddrinfo errors, but add inconsistency. - geomyidae - A small C-bas…
git clone git://bitreich.org/geomyidae/ git://enlrupgkhuxnvlhsf6lc3fziv5h2hhfri…
Log
Files
Refs
Tags
README
LICENSE
---
commit a8e69abfa2b38ef12bad79516bf02da7701d549c
parent bc06de10b6d279ef57ad0ba294610447bd2988fc
Author: Christoph Lohmann <[email protected]>
Date: Thu, 30 Aug 2018 19:07:11 +0200
Add true getaddrinfo errors, but add inconsistency.
We should all move to Plan 9.
Diffstat:
M main.c | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)
---
diff --git a/main.c b/main.c
@@ -290,16 +290,22 @@ initsignals(void)
signal(SIGPIPE, SIG_IGN);
}
+/*
+ * TODO: Move Linux and BSD to Plan 9 socket and bind handling, so we do not
+ * need the inconsistent return and exit on getaddrinfo.
+ */
int
getlistenfd(struct addrinfo *hints, char *bindip, char *port)
{
char addstr[INET6_ADDRSTRLEN];
struct addrinfo *ai, *rp;
void *sinaddr;
- int on, listfd;
+ int on, listfd, aierr;
- if (getaddrinfo(bindip, port, hints, &ai) || ai == NULL)
- return -1;
+ if ((aierr = getaddrinfo(bindip, port, hints, &ai)) || ai == NULL) {
+ fprintf(stderr, "getaddrinfo: %s\n", gai_strerror(aierr));
+ exit(1);
+ }
listfd = -1;
on = 1;
You are viewing proxied material from bitreich.org. The copyright of proxied material belongs to its original authors. Any comments or complaints in relation to proxied material should be directed to the original authors of the content concerned. Please see the disclaimer for more details.