Date: Tue, 10 Oct 2017 22:21:05 +0000 (UTC) From: Sean Bruno <sbruno@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r324508 - head/sys/kern Message-ID: <201710102221.v9AML554015782@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: sbruno Date: Tue Oct 10 22:21:05 2017 New Revision: 324508 URL: https://svnweb.freebsd.org/changeset/base/324508 Log: match sendfile() error handling to send(). Sendfile() should match the error checking order of send() which is currently: SBS_CANTSENDMORE so_error SS_ISCONNECTED Submitted by: Jason Eggleston <jason@eggnet.com> Reviewed by: glebius MFC after: 2 weeks Sponsored by: Limelight Networks Differential Revision: https://reviews.freebsd.org/D12633 Modified: head/sys/kern/kern_sendfile.c Modified: head/sys/kern/kern_sendfile.c ============================================================================== --- head/sys/kern/kern_sendfile.c Tue Oct 10 21:16:07 2017 (r324507) +++ head/sys/kern/kern_sendfile.c Tue Oct 10 22:21:05 2017 (r324508) @@ -507,8 +507,6 @@ sendfile_getsock(struct thread *td, int s, struct file *so = (*sock_fp)->f_data; if ((*so)->so_type != SOCK_STREAM) return (EINVAL); - if (((*so)->so_state & SS_ISCONNECTED) == 0) - return (ENOTCONN); return (0); } @@ -617,6 +615,12 @@ retry_space: SOCKBUF_UNLOCK(&so->so_snd); goto done; } + if ((so->so_state & SS_ISCONNECTED) == 0) { + SOCKBUF_UNLOCK(&so->so_snd); + error = ENOTCONN; + goto done; + } + space = sbspace(&so->so_snd); if (space < rem && (space <= 0 ||
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201710102221.v9AML554015782>