=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/aucat/Attic/safile.c,v retrieving revision 1.14 retrieving revision 1.15 diff -u -r1.14 -r1.15 --- src/usr.bin/aucat/Attic/safile.c 2009/07/25 10:52:19 1.14 +++ src/usr.bin/aucat/Attic/safile.c 2009/08/28 06:30:17 1.15 @@ -1,4 +1,4 @@ -/* $OpenBSD: safile.c,v 1.14 2009/07/25 10:52:19 ratchov Exp $ */ +/* $OpenBSD: safile.c,v 1.15 2009/08/28 06:30:17 ratchov Exp $ */ /* * Copyright (c) 2008 Alexandre Ratchov * @@ -34,6 +34,7 @@ struct safile { struct file file; struct sio_hdl *hdl; + int started; #ifdef DEBUG struct timeval itv, otv; #endif @@ -150,6 +151,7 @@ if (f == NULL) goto bad_close; f->hdl = hdl; + f->started = 0; sio_onmove(f->hdl, safile_cb, f); return f; bad_close: @@ -167,6 +169,7 @@ file_close(file); return; } + f->started = 1; DPRINTF("safile_start: play/rec started\n"); } @@ -180,6 +183,7 @@ file_close(file); return; } + f->started = 0; DPRINTF("safile_stop: play/rec stopped\n"); } @@ -281,5 +285,9 @@ void safile_close(struct file *file) { + struct safile *f = (struct safile *)file; + + if (f->started) + safile_stop(&f->file); return sio_close(((struct safile *)file)->hdl); }