svn commit: r305383 - head/sys/sys

Mateusz Guzik mjg at FreeBSD.org
Sun Sep 4 13:31:59 UTC 2016


Author: mjg
Date: Sun Sep  4 13:31:57 2016
New Revision: 305383
URL: https://svnweb.freebsd.org/changeset/base/305383

Log:
  fd: fix up fdeget_file
  
  It was supposed to return NULL if a fp is not installed.
  
  Facepalm-by: mjg

Modified:
  head/sys/sys/filedesc.h

Modified: head/sys/sys/filedesc.h
==============================================================================
--- head/sys/sys/filedesc.h	Sun Sep  4 12:22:14 2016	(r305382)
+++ head/sys/sys/filedesc.h	Sun Sep  4 13:31:57 2016	(r305383)
@@ -210,13 +210,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 (fd < 0 || 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-all mailing list