Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 21 Jan 2015 18:05:43 +0000 (UTC)
From:      Mateusz Guzik <mjg@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r277495 - head/sys/kern
Message-ID:  <201501211805.t0LI5hmt041966@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: mjg
Date: Wed Jan 21 18:05:42 2015
New Revision: 277495
URL: https://svnweb.freebsd.org/changeset/base/277495

Log:
  filedesc: return 0 from badfo_close
  
  The only potential in-tree consumer (_fdrop) special-cased it and returns 0
  0 on its own instead of calling badfo_close.
  
  Remove the special case since it is not needed and very unlikely to encounter
  anyway.
  
  No objections from:	kib

Modified:
  head/sys/kern/kern_descrip.c

Modified: head/sys/kern/kern_descrip.c
==============================================================================
--- head/sys/kern/kern_descrip.c	Wed Jan 21 18:02:28 2015	(r277494)
+++ head/sys/kern/kern_descrip.c	Wed Jan 21 18:05:42 2015	(r277495)
@@ -2680,11 +2680,9 @@ _fdrop(struct file *fp, struct thread *t
 {
 	int error;
 
-	error = 0;
 	if (fp->f_count != 0)
 		panic("fdrop: count %d", fp->f_count);
-	if (fp->f_ops != &badfileops)
-		error = fo_close(fp, td);
+	error = fo_close(fp, td);
 	atomic_subtract_int(&openfiles, 1);
 	crfree(fp->f_cred);
 	free(fp->f_advice, M_FADVISE);
@@ -3664,7 +3662,7 @@ static int
 badfo_close(struct file *fp, struct thread *td)
 {
 
-	return (EBADF);
+	return (0);
 }
 
 static int



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