summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorratchov <ratchov@openbsd.org>2011-06-03 16:22:34 +0000
committerratchov <ratchov@openbsd.org>2011-06-03 16:22:34 +0000
commitd88647d48b0f99afcb1589173711efb987614c0d (patch)
treea92b63b1029b1544a875793ab0a59f5587e0672f
parentrandomness might be broken, but this change (diff)
downloadwireguard-openbsd-d88647d48b0f99afcb1589173711efb987614c0d.tar.xz
wireguard-openbsd-d88647d48b0f99afcb1589173711efb987614c0d.zip
factor tests for f->opt->join flag, no behaviour change
-rw-r--r--usr.bin/aucat/sock.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/usr.bin/aucat/sock.c b/usr.bin/aucat/sock.c
index 26a5252a9c6..cab30a989e3 100644
--- a/usr.bin/aucat/sock.c
+++ b/usr.bin/aucat/sock.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sock.c,v 1.59 2011/05/02 22:32:29 ratchov Exp $ */
+/* $OpenBSD: sock.c,v 1.60 2011/06/03 16:22:34 ratchov Exp $ */
/*
* Copyright (c) 2008 Alexandre Ratchov <alex@caoua.org>
*
@@ -530,6 +530,7 @@ void
sock_attach(struct sock *f, int force)
{
struct abuf *rbuf, *wbuf;
+ unsigned rch, wch;
rbuf = LIST_FIRST(&f->pipe.file.rproc->outs);
wbuf = LIST_FIRST(&f->pipe.file.wproc->ins);
@@ -567,11 +568,13 @@ sock_attach(struct sock *f, int force)
* because dev_xxx() functions are supposed to
* work (i.e., not to crash)
*/
+ if (f->opt->join) {
+ rch = f->opt->rpar.cmax - f->opt->rpar.cmin + 1;
+ wch = f->opt->wpar.cmax - f->opt->wpar.cmin + 1;
+ } else
+ rch = wch = 0;
dev_attach(f->dev, f->pipe.file.name, f->mode,
- rbuf, &f->rpar,
- f->opt->join ? f->opt->rpar.cmax - f->opt->rpar.cmin + 1 : 0,
- wbuf, &f->wpar,
- f->opt->join ? f->opt->wpar.cmax - f->opt->wpar.cmin + 1 : 0,
+ rbuf, &f->rpar, rch, wbuf, &f->wpar, wch,
f->xrun, f->opt->maxweight);
if (f->mode & MODE_PLAY)
dev_setvol(f->dev, rbuf, MIDI_TO_ADATA(f->vol));