Introduction
Introduction Statistics Contact Development Disclaimer Help
A more robust accept() handling. - geomyidae - A small C-based gopherd.
git clone git://bitreich.org/geomyidae/ git://enlrupgkhuxnvlhsf6lc3fziv5h2hhfri…
Log
Files
Refs
Tags
README
LICENSE
---
commit 8eff8ae493a6f02e1a2b11cf69ac6cc84e4cace5
parent b54cf16cabdb38610da974759ce274be20e480f0
Author: Christoph Lohmann <[email protected]>
Date: Mon, 28 Feb 2011 00:46:09 +0100
A more robust accept() handling.
Diffstat:
M 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,
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.