Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. =================================================================== RCS file: /ftp/cvs/cvsroot/src/sys/miscfs/procfs/procfs_vnops.c,v rcsdiff: /ftp/cvs/cvsroot/src/sys/miscfs/procfs/procfs_vnops.c,v: warning: Unknown phrases like `commitid ...;' are present. retrieving revision 1.148.2.2 retrieving revision 1.148.2.3 diff -u -p -r1.148.2.2 -r1.148.2.3 --- src/sys/miscfs/procfs/procfs_vnops.c 2007/03/12 05:59:08 1.148.2.2 +++ src/sys/miscfs/procfs/procfs_vnops.c 2007/04/15 16:03:56 1.148.2.3 @@ -1,4 +1,4 @@ -/* $NetBSD: procfs_vnops.c,v 1.148.2.2 2007/03/12 05:59:08 rmind Exp $ */ +/* $NetBSD: procfs_vnops.c,v 1.148.2.3 2007/04/15 16:03:56 yamt Exp $ */ /*- * Copyright (c) 2006, 2007 The NetBSD Foundation, Inc. @@ -112,7 +112,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: procfs_vnops.c,v 1.148.2.2 2007/03/12 05:59:08 rmind Exp $"); +__KERNEL_RCSID(0, "$NetBSD: procfs_vnops.c,v 1.148.2.3 2007/04/15 16:03:56 yamt Exp $"); #include #include @@ -1555,13 +1555,15 @@ procfs_readlink(v) if ((error = procfs_proc_lock(pfs->pfs_pid, &pown, ESRCH)) != 0) return error; + mutex_enter(&pown->p_mutex); fp = fd_getfile(pown->p_fd, pfs->pfs_fd); mutex_exit(&pown->p_mutex); - if (error != 0) { + if (fp == NULL) { procfs_proc_unlock(pown); - return (EBADF); + return EBADF; } + FILE_USE(fp); switch (fp->f_type) { case DTYPE_VNODE: