summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorratchov <ratchov@openbsd.org>2010-06-05 16:14:44 +0000
committerratchov <ratchov@openbsd.org>2010-06-05 16:14:44 +0000
commit0366324f51117d510a6b42d9a8e64ead3f67291f (patch)
tree8938649ca488f3340e77b7026e4aa2aaea3cb15e
parentWhen closing the device, request clients using a midi control slot (diff)
downloadwireguard-openbsd-0366324f51117d510a6b42d9a8e64ead3f67291f.tar.xz
wireguard-openbsd-0366324f51117d510a6b42d9a8e64ead3f67291f.zip
in dev_close(), first terminate streams recording from the hardware,
then terminate streams recording from the monitor (if any). Otherwise, dev_close() would try to check if a stream is recording from the hardware or the monitor, and, if there's no monitor, would dereference a NULL pointer.
-rw-r--r--usr.bin/aucat/dev.c19
1 files changed, 15 insertions, 4 deletions
diff --git a/usr.bin/aucat/dev.c b/usr.bin/aucat/dev.c
index 3a259c42e9c..5815d84b733 100644
--- a/usr.bin/aucat/dev.c
+++ b/usr.bin/aucat/dev.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: dev.c,v 1.58 2010/06/05 16:00:52 ratchov Exp $ */
+/* $OpenBSD: dev.c,v 1.59 2010/06/05 16:14:44 ratchov Exp $ */
/*
* Copyright (c) 2008 Alexandre Ratchov <alex@caoua.org>
*
@@ -454,7 +454,7 @@ dev_close(struct dev *d)
goto restart_mix;
}
}
- } else if (d->sub || d->submon) {
+ } else if (d->sub) {
/*
* Same as above, but since there's no mixer,
* we generate EOF on the record-end of the
@@ -463,12 +463,23 @@ dev_close(struct dev *d)
restart_sub:
LIST_FOREACH(f, &file_list, entry) {
if (f->rproc != NULL &&
- (aproc_depend(d->sub, f->rproc) ||
- aproc_depend(d->submon, f->rproc))) {
+ aproc_depend(d->sub, f->rproc)) {
file_eof(f);
goto restart_sub;
}
}
+ } else if (d->submon) {
+ /*
+ * Same as above
+ */
+ restart_submon:
+ LIST_FOREACH(f, &file_list, entry) {
+ if (f->rproc != NULL &&
+ aproc_depend(d->submon, f->rproc)) {
+ file_eof(f);
+ goto restart_submon;
+ }
+ }
}
if (d->midi) {
d->midi->flags |= APROC_QUIT;