changeset 2460:eb924f20114f draft

Accepted sockets should be marked non blocking.
author Roy Marples <roy@marples.name>
date Fri, 02 May 2014 20:56:10 +0000
parents 4d3db760a69a
children 76bb5e8b8491
files control.c
diffstat 1 files changed, 6 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/control.c	Fri May 02 14:23:41 2014 +0000
+++ b/control.c	Fri May 02 20:56:10 2014 +0000
@@ -107,6 +107,12 @@
 		close(fd);
 	        return;
 	}
+	if ((flags = fcntl(fd, F_GETFL, 0)) == -1 ||
+	    fcntl(fd, F_SETFL, flags | O_NONBLOCK) == -1)
+	{
+		close(fd);
+	        return;
+	}
 	l = malloc(sizeof(*l));
 	if (l) {
 		l->ctx = ctx;