Introduction
Introduction Statistics Contact Development Disclaimer Help
Remove double usage of listfd. - geomyidae - A small C-based gopherd.
git clone git://bitreich.org/geomyidae/ git://enlrupgkhuxnvlhsf6lc3fziv5h2hhfri…
Log
Files
Refs
Tags
README
LICENSE
---
commit 3c940036398f0c5cb4b3822cb6f8ea1a76e2c968
parent e10b526637100dd52538ee4ebc1ad857018c3fee
Author: Christoph Lohmann <[email protected]>
Date: Sun, 11 Nov 2018 11:30:40 +0100
Remove double usage of listfd.
Diffstat:
M main.c | 20 ++++++++++----------
1 file changed, 10 insertions(+), 10 deletions(-)
---
diff --git a/main.c b/main.c
@@ -301,7 +301,7 @@ getlistenfd(struct addrinfo *hints, char *bindip, char *por…
char addstr[INET6_ADDRSTRLEN];
struct addrinfo *ai, *rp;
void *sinaddr;
- int on, listfd, aierr, errno_save;
+ int on, listenfd, aierr, errno_save;
if ((aierr = getaddrinfo(bindip, port, hints, &ai)) || ai == NULL) {
fprintf(stderr, "getaddrinfo (%s:%s): %s\n", bindip, port,
@@ -309,17 +309,17 @@ getlistenfd(struct addrinfo *hints, char *bindip, char *p…
exit(1);
}
- listfd = -1;
+ listenfd = -1;
on = 1;
for (rp = ai; rp != NULL; rp = rp->ai_next) {
- listfd = socket(rp->ai_family, rp->ai_socktype,
+ listenfd = socket(rp->ai_family, rp->ai_socktype,
rp->ai_protocol);
- if (listfd < 0)
+ if (listenfd < 0)
continue;
- if (setsockopt(listfd, SOL_SOCKET, SO_REUSEADDR, &on,
+ if (setsockopt(listenfd, SOL_SOCKET, SO_REUSEADDR, &on,
sizeof(on)) < 0) {
- close(listfd);
- listfd = -1;
+ close(listenfd);
+ listenfd = -1;
break;
}
@@ -327,7 +327,7 @@ getlistenfd(struct addrinfo *hints, char *bindip, char *por…
(void *)&((struct sockaddr_in *)rp->ai_addr)->sin_ad…
(void *)&((struct sockaddr_in6 *)rp->ai_addr)->sin6_…
- if (bind(listfd, rp->ai_addr, rp->ai_addrlen) == 0) {
+ if (bind(listenfd, rp->ai_addr, rp->ai_addrlen) == 0) {
if (loglvl & CONN && inet_ntop(rp->ai_family, sinaddr,
addstr, sizeof(addstr))) {
logentry(addstr, port, "-", "listening");
@@ -337,7 +337,7 @@ getlistenfd(struct addrinfo *hints, char *bindip, char *por…
/* Save errno, because fprintf in logentry overwrites it. */
errno_save = errno;
- close(listfd);
+ close(listenfd);
if (loglvl & CONN && inet_ntop(rp->ai_family, sinaddr,
addstr, sizeof(addstr))) {
logentry(addstr, port, "-", "could not bind");
@@ -348,7 +348,7 @@ getlistenfd(struct addrinfo *hints, char *bindip, char *por…
if (rp == NULL)
return -1;
- return listfd;
+ return listenfd;
}
void
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.