svn commit: samba r3313 - in branches/SAMBA_4_0/source/lib/socket: .

tridge at samba.org tridge at samba.org
Thu Oct 28 07:34:11 GMT 2004


Author: tridge
Date: 2004-10-28 07:34:11 +0000 (Thu, 28 Oct 2004)
New Revision: 3313

WebSVN: http://websvn.samba.org/websvn/changeset.php?rep=samba&path=/branches/SAMBA_4_0/source/lib/socket&rev=3313&nolog=1

Log:
in socket_accept() make the new socket non-blocking unless SOCKET_FLAG_BLOCK is set.

Modified:
   branches/SAMBA_4_0/source/lib/socket/socket_ipv4.c
   branches/SAMBA_4_0/source/lib/socket/socket_unix.c


Changeset:
Modified: branches/SAMBA_4_0/source/lib/socket/socket_ipv4.c
===================================================================
--- branches/SAMBA_4_0/source/lib/socket/socket_ipv4.c	2004-10-28 06:45:28 UTC (rev 3312)
+++ branches/SAMBA_4_0/source/lib/socket/socket_ipv4.c	2004-10-28 07:34:11 UTC (rev 3313)
@@ -141,6 +141,14 @@
 		return map_nt_error_from_unix(errno);
 	}
 
+	if (!(flags & SOCKET_FLAG_BLOCK)) {
+		int ret = set_blocking(new_fd, False);
+		if (ret == -1) {
+			close(new_fd);
+			return map_nt_error_from_unix(errno);
+		}
+	}
+
 	/* TODO: we could add a 'accept_check' hook here
 	 *	 which get the black/white lists via socket_set_accept_filter()
 	 *	 or something like that

Modified: branches/SAMBA_4_0/source/lib/socket/socket_unix.c
===================================================================
--- branches/SAMBA_4_0/source/lib/socket/socket_unix.c	2004-10-28 06:45:28 UTC (rev 3312)
+++ branches/SAMBA_4_0/source/lib/socket/socket_unix.c	2004-10-28 07:34:11 UTC (rev 3313)
@@ -136,6 +136,14 @@
 		return unixdom_error(errno);
 	}
 
+	if (!(flags & SOCKET_FLAG_BLOCK)) {
+		int ret = set_blocking(new_fd, False);
+		if (ret == -1) {
+			close(new_fd);
+			return map_nt_error_from_unix(errno);
+		}
+	}
+
 	(*new_sock) = talloc_p(NULL, struct socket_context);
 	if (!(*new_sock)) {
 		close(new_fd);



More information about the samba-cvs mailing list