svn commit: r277495 - head/sys/kern

Mateusz Guzik mjg at FreeBSD.org
Wed Jan 21 18:05:43 UTC 2015


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


More information about the svn-src-all mailing list