Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev call VOP_CLOSE() in the case we're bailing due to mi...



details:   https://anonhg.NetBSD.org/src/rev/cff6df51cc13
branches:  trunk
changeset: 773682:cff6df51cc13
user:      mrg <mrg%NetBSD.org@localhost>
date:      Mon Feb 13 01:47:16 2012 +0000

description:
call VOP_CLOSE() in the case we're bailing due to missing both read/write.
fixes vrelel() warnings when opening /dev/music on a device that doesn't
support the requested open flags.

diffstat:

 sys/dev/sequencer.c |  7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)

diffs (38 lines):

diff -r 41fe634f328b -r cff6df51cc13 sys/dev/sequencer.c
--- a/sys/dev/sequencer.c       Mon Feb 13 01:43:22 2012 +0000
+++ b/sys/dev/sequencer.c       Mon Feb 13 01:47:16 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: sequencer.c,v 1.53 2011/11/23 23:07:31 jmcneill Exp $  */
+/*     $NetBSD: sequencer.c,v 1.54 2012/02/13 01:47:16 mrg Exp $       */
 
 /*
  * Copyright (c) 1998, 2008 The NetBSD Foundation, Inc.
@@ -55,7 +55,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: sequencer.c,v 1.53 2011/11/23 23:07:31 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sequencer.c,v 1.54 2012/02/13 01:47:16 mrg Exp $");
 
 #include "sequencer.h"
 
@@ -1326,6 +1326,7 @@
        int major;
        dev_t dev;
        vnode_t *vp;
+       int oflags;
        
        major = devsw_name2chr("midi", NULL, 0);
        dev = makedev(major, unit);
@@ -1345,9 +1346,11 @@
 
        /* Only after we have acquired reference via VOP_OPEN(). */
        midi_getinfo(dev, &mi);
+       oflags = flags;
        if ((mi.props & MIDI_PROP_CAN_INPUT) == 0)
                flags &= ~FREAD;
        if ((flags & (FREAD|FWRITE)) == 0) {
+               VOP_CLOSE(vp, oflags, kauth_cred_get());
                vrele(vp);
                return NULL;
        }



Home | Main Index | Thread Index | Old Index