diff options
author | phk <phk@FreeBSD.org> | 2003-07-27 20:09:13 +0000 |
---|---|---|
committer | phk <phk@FreeBSD.org> | 2003-07-27 20:09:13 +0000 |
commit | e457974b5d32523a8e299714c5490b150f1aa505 (patch) | |
tree | ff4864a8675f48e6f9e563d453a6ceea7ae0ef6c /sys | |
parent | b80d7fd8a0c1f1addc6ce976b9ca5863a97f959a (diff) | |
download | FreeBSD-src-e457974b5d32523a8e299714c5490b150f1aa505.zip FreeBSD-src-e457974b5d32523a8e299714c5490b150f1aa505.tar.gz |
Pass the file descriptor index down to vn_open.
If the method vector was replaced and we got the "special return code"
smile and trust that whatever happened below DTRT.
Diffstat (limited to 'sys')
-rw-r--r-- | sys/kern/vfs_extattr.c | 14 | ||||
-rw-r--r-- | sys/kern/vfs_syscalls.c | 14 |
2 files changed, 26 insertions, 2 deletions
diff --git a/sys/kern/vfs_extattr.c b/sys/kern/vfs_extattr.c index 7aa1729..f04664f 100644 --- a/sys/kern/vfs_extattr.c +++ b/sys/kern/vfs_extattr.c @@ -685,8 +685,20 @@ kern_open(struct thread *td, char *path, enum uio_seg pathseg, int flags, * the descriptor while we are blocked in vn_open() */ fhold(fp); - error = vn_open(&nd, &flags, cmode, -1); + error = vn_open(&nd, &flags, cmode, indx); if (error) { + + /* + * If the vn_open replaced the method vector, something + * wonderous happened deep below and we just pass it up + * pretending we know what we do. + */ + if (error == ENXIO && fp->f_ops != &badfileops) { + fdrop(fp, td); + td->td_retval[0] = indx; + return (0); + } + /* * release our own reference */ diff --git a/sys/kern/vfs_syscalls.c b/sys/kern/vfs_syscalls.c index 7aa1729..f04664f 100644 --- a/sys/kern/vfs_syscalls.c +++ b/sys/kern/vfs_syscalls.c @@ -685,8 +685,20 @@ kern_open(struct thread *td, char *path, enum uio_seg pathseg, int flags, * the descriptor while we are blocked in vn_open() */ fhold(fp); - error = vn_open(&nd, &flags, cmode, -1); + error = vn_open(&nd, &flags, cmode, indx); if (error) { + + /* + * If the vn_open replaced the method vector, something + * wonderous happened deep below and we just pass it up + * pretending we know what we do. + */ + if (error == ENXIO && fp->f_ops != &badfileops) { + fdrop(fp, td); + td->td_retval[0] = indx; + return (0); + } + /* * release our own reference */ |