svn commit: r324508 - head/sys/kern

Sean Bruno sbruno at FreeBSD.org
Tue Oct 10 22:21:07 UTC 2017


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 at 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 ||


More information about the svn-src-all mailing list