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;
                }
                /*
_______________________________________________
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to