geomyidae

A small C-based gopherd. (gopher://bitreich.org/1/scm/geomyidae)
git clone git://r-36.net/geomyidae
Log | Files | Refs | README | LICENSE

commit 8eff8ae493a6f02e1a2b11cf69ac6cc84e4cace5
parent b54cf16cabdb38610da974759ce274be20e480f0
Author: Christoph Lohmann <20h@r-36.net>
Date:   Mon, 28 Feb 2011 00:46:09 +0100

A more robust accept() handling.

Diffstat:
main.c | 13++++++++++---
1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/main.c b/main.c @@ -19,6 +19,7 @@ #include <time.h> #include <pwd.h> #include <grp.h> +#include <errno.h> #include "ind.h" #include "handlr.h" @@ -373,9 +374,15 @@ main(int argc, char *argv[]) while(running) { sock = accept(list, (struct sockaddr *)&clt, &cltlen); if(sock < 0) { - perror("accept"); - close(list); - return 1; + switch(errno) { + case ECONNABORTED: + case EINTR: + continue; + default: + perror("accept"); + close(list); + return 1; + } } getnameinfo((struct sockaddr *)&clt, cltlen, clienth,