[PATCH] sendfile erroniously returns ENOTCONN.

David G. Lawrence dg at root.com
Sat Jan 3 00:55:11 PST 2004


> * David G. Lawrence <dg at dglawrence.com> [040102 21:41] wrote:
> > 
> >    sendfile(8) tries to maintain compatibility with sosend as much as is
> > reasonable. ENOTCONN is the appropriate error to return if the socket
> > isn't connected. sosend checks SS_CANTSENDMORE prior to the check for
> > SS_ISCONNECTED, however, and returns EPIPE in that case. Perhaps sendfile
> > should be changed to do the same (just a though - I'm not proposing
> > that this be done).
> >    Removing the check entirely seems clearly wrong, however.
> 
> I had forgotten that sendfile bypasses sosend(9).  I could
> add the check, is there a reason not to?  The one reason I
> figured was that sometimes blocking sigpipe can be hairy inside
> libraries.   Now that we can selectively disable SIGPIPE using
> the setsockopt using Apple's code this is less of an issue.

   Yes, I think checking for SS_CATSENDMORE (and returning EPIPE) prior to
checking SS_ISCONNECTED (and returning ENOTCONN as it does now) is the right
thing to do.

-DG

David G. Lawrence
President
Download Technologies, Inc. - http://www.downloadtech.com - (866) 399 8500
TeraSolutions, Inc. - http://www.terasolutions.com - (888) 346 7175
The FreeBSD Project - http://www.freebsd.org
Pave the road of life with opportunities.


More information about the freebsd-hackers mailing list