Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 13 Aug 2011 16:03:40 +0000 (UTC)
From:      Robert Watson <rwatson@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r224842 - head/sys/kern
Message-ID:  <201108131603.p7DG3e80023093@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: rwatson
Date: Sat Aug 13 16:03:40 2011
New Revision: 224842
URL: http://svn.freebsd.org/changeset/base/224842

Log:
  When falloc() was broken into separate falloc_noinstall() and finstall(),
  a bug was introduced in kern_openat() such that the error from the vnode
  open operation was overwritten before it was passed as an argument to
  dupfdopen().  This broke operations on /dev/{stdin,stdout,stderr}.  Fix
  by preserving the original error number across finstall() so that it is
  still available.
  
  Approved by:	re (kib)
  Reported by:	cognet

Modified:
  head/sys/kern/vfs_syscalls.c

Modified: head/sys/kern/vfs_syscalls.c
==============================================================================
--- head/sys/kern/vfs_syscalls.c	Sat Aug 13 13:49:11 2011	(r224841)
+++ head/sys/kern/vfs_syscalls.c	Sat Aug 13 16:03:40 2011	(r224842)
@@ -1086,7 +1086,7 @@ kern_openat(struct thread *td, int fd, c
 	struct vnode *vp;
 	int cmode;
 	struct file *nfp;
-	int type, indx = -1, error;
+	int type, indx = -1, error, error_open;
 	struct flock lf;
 	struct nameidata nd;
 	int vfslocked;
@@ -1145,10 +1145,11 @@ kern_openat(struct thread *td, int fd, c
 		    (error == ENODEV || error == ENXIO) &&
 		    (td->td_dupfd >= 0)) {
 			/* XXX from fdopen */
+			error_open = error;
 			if ((error = finstall(td, fp, &indx, flags)) != 0)
 				goto bad_unlocked;
 			if ((error = dupfdopen(td, fdp, indx, td->td_dupfd,
-			    flags, error)) == 0)
+			    flags, error_open)) == 0)
 				goto success;
 		}
 		/*



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