diff options
author | Alexandre Ratchov <ratchov@cvs.openbsd.org> | 2009-11-05 08:36:49 +0000 |
---|---|---|
committer | Alexandre Ratchov <ratchov@cvs.openbsd.org> | 2009-11-05 08:36:49 +0000 |
commit | 5210a0b5123c35018c558ab47cd81a260cb427a1 (patch) | |
tree | 08c393191582e253b55e85ff898cecaee2aef6c0 /usr.bin | |
parent | fd1eb2c0ea221b7cb41464f57c6b8fd57afc00bc (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')
-rw-r--r-- | usr.bin/aucat/aproc.c | 18 | ||||
-rw-r--r-- | usr.bin/aucat/miofile.c | 6 | ||||
-rw-r--r-- | usr.bin/aucat/safile.c | 6 |
3 files changed, 25 insertions, 5 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); diff --git a/usr.bin/aucat/miofile.c b/usr.bin/aucat/miofile.c index 7e797b30bde..d8c45125113 100644 --- a/usr.bin/aucat/miofile.c +++ b/usr.bin/aucat/miofile.c @@ -1,4 +1,4 @@ -/* $OpenBSD: miofile.c,v 1.2 2009/09/27 11:51:20 ratchov Exp $ */ +/* $OpenBSD: miofile.c,v 1.3 2009/11/05 08:36:48 ratchov Exp $ */ /* * Copyright (c) 2008 Alexandre Ratchov <alex@caoua.org> * @@ -72,7 +72,9 @@ miofile_new(struct fileops *ops, char *path, int input, int output) hdl = mio_open(path, mode, 1); if (hdl == NULL) return NULL; - f = (struct miofile *)file_new(ops, "hdl", mio_nfds(hdl)); + if (path == NULL) + path = "default"; + f = (struct miofile *)file_new(ops, path, mio_nfds(hdl)); if (f == NULL) goto bad_close; f->hdl = hdl; diff --git a/usr.bin/aucat/safile.c b/usr.bin/aucat/safile.c index eae7808228b..425c44cec5e 100644 --- a/usr.bin/aucat/safile.c +++ b/usr.bin/aucat/safile.c @@ -1,4 +1,4 @@ -/* $OpenBSD: safile.c,v 1.18 2009/09/27 11:51:20 ratchov Exp $ */ +/* $OpenBSD: safile.c,v 1.19 2009/11/05 08:36:48 ratchov Exp $ */ /* * Copyright (c) 2008 Alexandre Ratchov <alex@caoua.org> * @@ -143,7 +143,9 @@ safile_new(struct fileops *ops, char *path, } *bufsz = par.bufsz; *round = par.round; - f = (struct safile *)file_new(ops, "hdl", sio_nfds(hdl)); + if (path == NULL) + path = "default"; + f = (struct safile *)file_new(ops, path, sio_nfds(hdl)); if (f == NULL) goto bad_close; f->hdl = hdl; |