summaryrefslogtreecommitdiff
path: root/lib/libsndio/aucat.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/libsndio/aucat.c')
-rw-r--r--lib/libsndio/aucat.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/lib/libsndio/aucat.c b/lib/libsndio/aucat.c
index 681411700de..272df65d246 100644
--- a/lib/libsndio/aucat.c
+++ b/lib/libsndio/aucat.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: aucat.c,v 1.30 2009/10/22 21:41:30 ratchov Exp $ */
+/* $OpenBSD: aucat.c,v 1.31 2009/10/24 09:35:16 ratchov Exp $ */
/*
* Copyright (c) 2008 Alexandre Ratchov <alex@caoua.org>
*
@@ -546,8 +546,12 @@ aucat_buildmsg(struct aucat_hdl *hdl, size_t len)
hdl->wmsg.u.vol.ctl = hdl->reqvol;
hdl->curvol = hdl->reqvol;
return 1;
- } else if (len > 0) {
- sz = (len < AMSG_DATAMAX) ? len : AMSG_DATAMAX;
+ } else if (len > 0 && hdl->maxwrite > 0) {
+ sz = len;
+ if (sz > AMSG_DATAMAX)
+ sz = AMSG_DATAMAX;
+ if (sz > hdl->maxwrite)
+ sz = hdl->maxwrite;
sz -= sz % hdl->wbpf;
if (sz == 0)
sz = hdl->wbpf;