Module Name: src Committed By: rmind Date: Fri May 13 22:31:08 UTC 2011
Modified Files: src/sys/dev/filemon: filemon.c Log Message: filemon_open: remove unnecessary check (which has a leak in error path). To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/sys/dev/filemon/filemon.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/dev/filemon/filemon.c diff -u src/sys/dev/filemon/filemon.c:1.1 src/sys/dev/filemon/filemon.c:1.2 --- src/sys/dev/filemon/filemon.c:1.1 Thu Sep 9 00:10:16 2010 +++ src/sys/dev/filemon/filemon.c Fri May 13 22:31:08 2011 @@ -24,7 +24,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: filemon.c,v 1.1 2010/09/09 00:10:16 sjg Exp $"); +__KERNEL_RCSID(0, "$NetBSD: filemon.c,v 1.2 2011/05/13 22:31:08 rmind Exp $"); #include <sys/param.h> #include <sys/kernel.h> @@ -195,20 +195,16 @@ return error; filemon = kmem_alloc(sizeof(struct filemon), KM_SLEEP); - if (!filemon) - return ENOMEM; - rw_init(&filemon->fm_mtx); filemon->fm_fd = -1; filemon->fm_fp = NULL; filemon->fm_pid = curproc->p_pid; rw_enter(&filemon_mtx, RW_WRITER); - n_open++; - TAILQ_INSERT_TAIL(&filemons_inuse, filemon, fm_link); - + n_open++; rw_exit(&filemon_mtx); + return fd_clone(fp, fd, oflags, &filemon_fileops, filemon); }