summaryrefslogtreecommitdiffstats
path: root/sys/kern/vfs_syscalls.c
diff options
context:
space:
mode:
authorrwatson <rwatson@FreeBSD.org>2011-08-13 16:03:40 +0000
committerrwatson <rwatson@FreeBSD.org>2011-08-13 16:03:40 +0000
commit11c783ae3f03a5098cfec65d1e5aaa1409bcb373 (patch)
tree4fc751f3988ccc4560590aa3a7820e51b8afc885 /sys/kern/vfs_syscalls.c
parent55a0d5cba60d0d57114e310faac6158236d9c738 (diff)
downloadFreeBSD-src-11c783ae3f03a5098cfec65d1e5aaa1409bcb373.zip
FreeBSD-src-11c783ae3f03a5098cfec65d1e5aaa1409bcb373.tar.gz
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
Diffstat (limited to 'sys/kern/vfs_syscalls.c')
-rw-r--r--sys/kern/vfs_syscalls.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/sys/kern/vfs_syscalls.c b/sys/kern/vfs_syscalls.c
index 3d2e1d4..35d1aee 100644
--- a/sys/kern/vfs_syscalls.c
+++ b/sys/kern/vfs_syscalls.c
@@ -1086,7 +1086,7 @@ kern_openat(struct thread *td, int fd, char *path, enum uio_seg pathseg,
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, char *path, enum uio_seg pathseg,
(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;
}
/*
OpenPOWER on IntegriCloud