diff options
author | Alexandre Ratchov <ratchov@cvs.openbsd.org> | 2009-08-28 10:52:15 +0000 |
---|---|---|
committer | Alexandre Ratchov <ratchov@cvs.openbsd.org> | 2009-08-28 10:52:15 +0000 |
commit | ec4dc37af730fadb05361383e63e3c2beaca1676 (patch) | |
tree | 975097cd1e5b94fe22344a46470fe77c92b52b36 /lib | |
parent | 108f257f24e18009679b6fe7ea32d9edea9ec778 (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')
-rw-r--r-- | lib/libsndio/aucat.c | 4 | ||||
-rw-r--r-- | lib/libsndio/sndio.c | 6 |
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); } |