svn commit: r315895 - stable/11/sys/sys

Mateusz Guzik mjg at FreeBSD.org
Fri Mar 24 08:06:01 UTC 2017


Author: mjg
Date: Fri Mar 24 08:06:00 2017
New Revision: 315895
URL: https://svnweb.freebsd.org/changeset/base/315895

Log:
  MFC r305383:
  
  fd: fix up fdeget_file
  
  It was supposed to return NULL if a fp is not installed.

Modified:
  stable/11/sys/sys/filedesc.h
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/sys/filedesc.h
==============================================================================
--- stable/11/sys/sys/filedesc.h	Fri Mar 24 07:22:32 2017	(r315894)
+++ stable/11/sys/sys/filedesc.h	Fri Mar 24 08:06:00 2017	(r315895)
@@ -215,13 +215,18 @@ fget_locked(struct filedesc *fdp, int fd
 static __inline struct filedescent *
 fdeget_locked(struct filedesc *fdp, int fd)
 {
+	struct filedescent *fde;
 
 	FILEDESC_LOCK_ASSERT(fdp);
 
 	if ((u_int)fd > fdp->fd_lastfile)
 		return (NULL);
 
-	return (&fdp->fd_ofiles[fd]);
+	fde = &fdp->fd_ofiles[fd];
+	if (fde->fde_file == NULL)
+		return (NULL);
+
+	return (fde);
 }
 
 static __inline bool


More information about the svn-src-stable-11 mailing list