summaryrefslogtreecommitdiff
path: root/usr.bin/aucat
diff options
context:
space:
mode:
authorAlexandre Ratchov <ratchov@cvs.openbsd.org>2010-06-05 16:14:45 +0000
committerAlexandre Ratchov <ratchov@cvs.openbsd.org>2010-06-05 16:14:45 +0000
commit03a8b3d6bceb1215c4679acab05f2c5ebb49536f (patch)
treeef5a8767d295eb1ef857e508481739ada65e0983 /usr.bin/aucat
parentecb1c7fc2b2f86863b943929ec79301a99b7e338 (diff)
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.
Diffstat (limited to 'usr.bin/aucat')
-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;