Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 24 Mar 2017 08:06:00 +0000 (UTC)
From:      Mateusz Guzik <mjg@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org
Subject:   svn commit: r315895 - stable/11/sys/sys
Message-ID:  <201703240806.v2O860Mp081818@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201703240806.v2O860Mp081818>