[PATCH] sendfile erroniously returns ENOTCONN.

Alfred Perlstein alfred at freebsd.org
Fri Jan 2 16:53:40 PST 2004


sendfile(2) returns ENOTCONN when the remote side has disconnected instead
of EPIPE.  Can this fix be applied?  Is there a reason for it being the
way it is?  I know EPIPE can cause SIGPIPE which can cause problems, but
the error here is incorrect, and considering that the manpage mentions
EPIPE as a possible error... is this perhaps due to a change in the
socket flags API?  I know the problem is on 4.x and 5.x.

Index: uipc_syscalls.c
===================================================================
RCS file: /home/ncvs/src/sys/kern/uipc_syscalls.c,v
retrieving revision 1.162
diff -u -r1.162 uipc_syscalls.c
--- uipc_syscalls.c	28 Dec 2003 08:57:08 -0000	1.162
+++ uipc_syscalls.c	2 Jan 2004 21:56:10 -0000
@@ -1697,10 +1697,6 @@
 		error = EINVAL;
 		goto done;
 	}
-	if ((so->so_state & SS_ISCONNECTED) == 0) {
-		error = ENOTCONN;
-		goto done;
-	}
 	if (uap->offset < 0) {
 		error = EINVAL;
 		goto done;


-- 
- Alfred Perlstein
- Research Engineering Development Inc.
- email: bright at mu.org cell: 408-480-4684


More information about the freebsd-hackers mailing list