summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert James Kaes <rjkaes@users.sourceforge.net>2001-12-28 22:29:11 +0000
committerRobert James Kaes <rjkaes@users.sourceforge.net>2001-12-28 22:29:11 +0000
commita0dee6c57f27d59b253ce496818bc12aa2de9a56 (patch)
tree2e26843a9e5bf78c18c4c1a0f7df805d2f427baa
parent8cfe33fc4a2252c09ff0e901f940614d146fa145 (diff)
downloadtinyproxy-a0dee6c57f27d59b253ce496818bc12aa2de9a56.tar.gz
tinyproxy-a0dee6c57f27d59b253ce496818bc12aa2de9a56.zip
Check for errors returned by the accept() function.
Diffstat (limited to '')
-rw-r--r--ChangeLog5
-rw-r--r--src/thread.c11
2 files changed, 15 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index 68468f9..4b3d2ac 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2001-12-28 Robert James Kaes <rjkaes@flarenet.com>
+
+ * src/thread.c (thread_main): Added code to detect errors in the
+ accept() function.
+
2001-12-23 Robert James Kaes <rjkaes@flarenet.com>
* src/utils.c (send_http_message): Use the write_message()
diff --git a/src/thread.c b/src/thread.c
index 66f13d9..4ea1bbf 100644
--- a/src/thread.c
+++ b/src/thread.c
@@ -1,4 +1,4 @@
-/* $Id: thread.c,v 1.18 2001-11-22 00:31:10 rjkaes Exp $
+/* $Id: thread.c,v 1.19 2001-12-28 22:29:11 rjkaes Exp $
*
* Handles the creation/destruction of the various threads required for
* processing incoming connections.
@@ -131,6 +131,15 @@ thread_main(void *arg)
connfd = accept(listenfd, cliaddr, &clilen);
pthread_mutex_unlock(&mlock);
+ /*
+ * Make sure no error occurred...
+ */
+ if (connfd < 0) {
+ log_message(LOG_ERR, "Accept returned an error (%s) ... retrying.", strerror(errno));
+ continue;
+ }
+
+
ptr->status = T_CONNECTED;
SERVER_DEC();