summaryrefslogtreecommitdiff
path: root/usr.bin/aucat/aproc.c
diff options
context:
space:
mode:
authorAlexandre Ratchov <ratchov@cvs.openbsd.org>2009-11-05 08:36:49 +0000
committerAlexandre Ratchov <ratchov@cvs.openbsd.org>2009-11-05 08:36:49 +0000
commit5210a0b5123c35018c558ab47cd81a260cb427a1 (patch)
tree08c393191582e253b55e85ff898cecaee2aef6c0 /usr.bin/aucat/aproc.c
parentfd1eb2c0ea221b7cb41464f57c6b8fd57afc00bc (diff)
in rpipe_done (wpipe_done), all buffers must be detached
before deleting the writer (reader) otherwise the later could trigger rpipe_done again.
Diffstat (limited to 'usr.bin/aucat/aproc.c')
-rw-r--r--usr.bin/aucat/aproc.c18
1 files changed, 17 insertions, 1 deletions
diff --git a/usr.bin/aucat/aproc.c b/usr.bin/aucat/aproc.c
index 6e64b8c9229..f5d7375ff07 100644
--- a/usr.bin/aucat/aproc.c
+++ b/usr.bin/aucat/aproc.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: aproc.c,v 1.38 2009/11/03 21:31:37 ratchov Exp $ */
+/* $OpenBSD: aproc.c,v 1.39 2009/11/05 08:36:48 ratchov Exp $ */
/*
* Copyright (c) 2008 Alexandre Ratchov <alex@caoua.org>
*
@@ -199,9 +199,17 @@ void
rpipe_done(struct aproc *p)
{
struct file *f = p->u.io.file;
+ struct abuf *obuf;
if (f == NULL)
return;
+ /*
+ * all buffers must be detached before deleting f->wproc,
+ * because otherwise it could trigger this code again
+ */
+ obuf = LIST_FIRST(&p->obuflist);
+ if (obuf)
+ abuf_eof(obuf);
if (f->wproc) {
f->rproc = NULL;
aproc_del(f->wproc);
@@ -250,9 +258,17 @@ void
wpipe_done(struct aproc *p)
{
struct file *f = p->u.io.file;
+ struct abuf *ibuf;
if (f == NULL)
return;
+ /*
+ * all buffers must be detached before deleting f->rproc,
+ * because otherwise it could trigger this code again
+ */
+ ibuf = LIST_FIRST(&p->ibuflist);
+ if (ibuf)
+ abuf_hup(ibuf);
if (f->rproc) {
f->wproc = NULL;
aproc_del(f->rproc);