summaryrefslogtreecommitdiff
path: root/lib/libsndio
diff options
context:
space:
mode:
authorAlexandre Ratchov <ratchov@cvs.openbsd.org>2009-08-28 10:52:15 +0000
committerAlexandre Ratchov <ratchov@cvs.openbsd.org>2009-08-28 10:52:15 +0000
commitec4dc37af730fadb05361383e63e3c2beaca1676 (patch)
tree975097cd1e5b94fe22344a46470fe77c92b52b36 /lib/libsndio
parent108f257f24e18009679b6fe7ea32d9edea9ec778 (diff)
don't consider calling sio_close() without calling sio_stop() first
as a programming error. At any stage the program should be alble to cleanly free resources and close the device.
Diffstat (limited to 'lib/libsndio')
-rw-r--r--lib/libsndio/aucat.c4
-rw-r--r--lib/libsndio/sndio.c6
2 files changed, 4 insertions, 6 deletions
diff --git a/lib/libsndio/aucat.c b/lib/libsndio/aucat.c
index b830894f7f7..b8d274ef97b 100644
--- a/lib/libsndio/aucat.c
+++ b/lib/libsndio/aucat.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: aucat.c,v 1.27 2009/08/28 10:03:36 ratchov Exp $ */
+/* $OpenBSD: aucat.c,v 1.28 2009/08/28 10:52:14 ratchov Exp $ */
/*
* Copyright (c) 2008 Alexandre Ratchov <alex@caoua.org>
*
@@ -272,6 +272,8 @@ aucat_close(struct sio_hdl *sh)
struct aucat_hdl *hdl = (struct aucat_hdl *)sh;
char dummy[1];
+ if (!hdl->sio.eof && hdl->sio.started)
+ (void)aucat_stop(&hdl->sio);
if (!hdl->sio.eof) {
AMSG_INIT(&hdl->wmsg);
hdl->wmsg.cmd = AMSG_BYE;
diff --git a/lib/libsndio/sndio.c b/lib/libsndio/sndio.c
index 23127bb722e..a4da9322070 100644
--- a/lib/libsndio/sndio.c
+++ b/lib/libsndio/sndio.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sndio.c,v 1.22 2009/08/28 06:37:06 ratchov Exp $ */
+/* $OpenBSD: sndio.c,v 1.23 2009/08/28 10:52:14 ratchov Exp $ */
/*
* Copyright (c) 2008 Alexandre Ratchov <alex@caoua.org>
*
@@ -237,10 +237,6 @@ sio_create(struct sio_hdl *hdl, struct sio_ops *ops, unsigned mode, int nbio)
void
sio_close(struct sio_hdl *hdl)
{
- if (!hdl->eof && hdl->started) {
- DPRINTF("sio_close: not stopped\n");
- hdl->eof = 1;
- }
hdl->ops->close(hdl);
}