summaryrefslogtreecommitdiff
path: root/usr.bin/sndiod
diff options
context:
space:
mode:
authorAlexandre Ratchov <ratchov@cvs.openbsd.org>2014-03-05 20:04:22 +0000
committerAlexandre Ratchov <ratchov@cvs.openbsd.org>2014-03-05 20:04:22 +0000
commit82ab3f958d22d9d584fea744d3a3c12fc3195ed3 (patch)
tree9fe5bef61e10092bab22018e3e44b496aa4d4a3a /usr.bin/sndiod
parent542fbce2cd10bd410e555ca9852d266eaf781241 (diff)
Check that socket is writable before attempting to write data
packets.
Diffstat (limited to 'usr.bin/sndiod')
-rw-r--r--usr.bin/sndiod/sock.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/usr.bin/sndiod/sock.c b/usr.bin/sndiod/sock.c
index 709e91ca5f0..685f20daddd 100644
--- a/usr.bin/sndiod/sock.c
+++ b/usr.bin/sndiod/sock.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sock.c,v 1.9 2014/02/08 15:15:31 ratchov Exp $ */
+/* $OpenBSD: sock.c,v 1.10 2014/03/05 20:04:21 ratchov Exp $ */
/*
* Copyright (c) 2008-2012 Alexandre Ratchov <alex@caoua.org>
*
@@ -1413,7 +1413,7 @@ sock_buildmsg(struct sock *f)
/*
* If data available, build a DATA message.
*/
- if (f->slot != NULL && f->slot->sub.buf.used > 0 && f->wmax > 0) {
+ if (f->slot != NULL && f->wmax > 0 && f->slot->sub.buf.used > 0) {
size = f->slot->sub.buf.used;
if (size > AMSG_DATAMAX)
size = AMSG_DATAMAX;