vfs_syscalls.c (192001) | vfs_syscalls.c (192080) |
---|---|
1/*- 2 * Copyright (c) 1989, 1993 3 * The Regents of the University of California. All rights reserved. 4 * (c) UNIX System Laboratories, Inc. 5 * All or some portions of this file are derived from material licensed 6 * to the University of California by American Telephone and Telegraph 7 * Co. or Unix System Laboratories, Inc. and are reproduced herein with 8 * the permission of UNIX System Laboratories, Inc. --- 21 unchanged lines hidden (view full) --- 30 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 31 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 32 * SUCH DAMAGE. 33 * 34 * @(#)vfs_syscalls.c 8.13 (Berkeley) 4/15/94 35 */ 36 37#include <sys/cdefs.h> | 1/*- 2 * Copyright (c) 1989, 1993 3 * The Regents of the University of California. All rights reserved. 4 * (c) UNIX System Laboratories, Inc. 5 * All or some portions of this file are derived from material licensed 6 * to the University of California by American Telephone and Telegraph 7 * Co. or Unix System Laboratories, Inc. and are reproduced herein with 8 * the permission of UNIX System Laboratories, Inc. --- 21 unchanged lines hidden (view full) --- 30 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 31 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 32 * SUCH DAMAGE. 33 * 34 * @(#)vfs_syscalls.c 8.13 (Berkeley) 4/15/94 35 */ 36 37#include <sys/cdefs.h> |
38__FBSDID("$FreeBSD: head/sys/kern/vfs_syscalls.c 192001 2009-05-11 19:58:03Z kib $"); | 38__FBSDID("$FreeBSD: head/sys/kern/vfs_syscalls.c 192080 2009-05-14 03:24:22Z jeff $"); |
39 40#include "opt_compat.h" 41#include "opt_kdtrace.h" 42#include "opt_ktrace.h" 43#include "opt_mac.h" 44 45#include <sys/param.h> 46#include <sys/systm.h> --- 4183 unchanged lines hidden (view full) --- 4230getvnode(fdp, fd, fpp) 4231 struct filedesc *fdp; 4232 int fd; 4233 struct file **fpp; 4234{ 4235 int error; 4236 struct file *fp; 4237 | 39 40#include "opt_compat.h" 41#include "opt_kdtrace.h" 42#include "opt_ktrace.h" 43#include "opt_mac.h" 44 45#include <sys/param.h> 46#include <sys/systm.h> --- 4183 unchanged lines hidden (view full) --- 4230getvnode(fdp, fd, fpp) 4231 struct filedesc *fdp; 4232 int fd; 4233 struct file **fpp; 4234{ 4235 int error; 4236 struct file *fp; 4237 |
4238 error = 0; |
|
4238 fp = NULL; | 4239 fp = NULL; |
4239 if (fdp == NULL) | 4240 if (fdp == NULL || (fp = fget_unlocked(fdp, fd)) == NULL) |
4240 error = EBADF; | 4241 error = EBADF; |
4241 else { 4242 FILEDESC_SLOCK(fdp); 4243 if ((u_int)fd >= fdp->fd_nfiles || 4244 (fp = fdp->fd_ofiles[fd]) == NULL) 4245 error = EBADF; 4246 else if (fp->f_vnode == NULL) { 4247 fp = NULL; 4248 error = EINVAL; 4249 } else { 4250 fhold(fp); 4251 error = 0; 4252 } 4253 FILEDESC_SUNLOCK(fdp); | 4242 else if (fp->f_vnode == NULL) { 4243 error = EINVAL; 4244 fdrop(fp, curthread); |
4254 } 4255 *fpp = fp; 4256 return (error); 4257} 4258 4259/* 4260 * Get an (NFS) file handle. 4261 */ --- 390 unchanged lines hidden --- | 4245 } 4246 *fpp = fp; 4247 return (error); 4248} 4249 4250/* 4251 * Get an (NFS) file handle. 4252 */ --- 390 unchanged lines hidden --- |