summaryrefslogtreecommitdiff
path: root/usr.bin
diff options
context:
space:
mode:
authorAlexandre Ratchov <ratchov@cvs.openbsd.org>2015-12-14 17:44:30 +0000
committerAlexandre Ratchov <ratchov@cvs.openbsd.org>2015-12-14 17:44:30 +0000
commitc2f5b6946d888389bea952156191c19a4646e8c3 (patch)
tree3371fa6dcadd7bd72e330a686fdce1474efeb231 /usr.bin
parenta814b9c18627f8bbcde06c486870e4b4d6dc4de3 (diff)
Work on a copy of the slowaccept flag instead of the global one as
it could change somewhere in the poll() loop.
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/sndiod/listen.c9
-rw-r--r--usr.bin/sndiod/listen.h3
2 files changed, 9 insertions, 3 deletions
diff --git a/usr.bin/sndiod/listen.c b/usr.bin/sndiod/listen.c
index dca8466fa4e..89aba805d1f 100644
--- a/usr.bin/sndiod/listen.c
+++ b/usr.bin/sndiod/listen.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: listen.c,v 1.3 2015/11/18 08:36:20 ratchov Exp $ */
+/* $OpenBSD: listen.c,v 1.4 2015/12/14 17:44:29 ratchov Exp $ */
/*
* Copyright (c) 2008 Alexandre Ratchov <alex@caoua.org>
*
@@ -218,7 +218,8 @@ listen_pollfd(void *arg, struct pollfd *pfd)
{
struct listen *f = arg;
- if (file_slowaccept)
+ f->slowaccept = file_slowaccept;
+ if (f->slowaccept)
return 0;
pfd->fd = f->fd;
pfd->events = POLLIN;
@@ -228,6 +229,10 @@ listen_pollfd(void *arg, struct pollfd *pfd)
int
listen_revents(void *arg, struct pollfd *pfd)
{
+ struct listen *f = arg;
+
+ if (f->slowaccept)
+ return 0;
return pfd->revents;
}
diff --git a/usr.bin/sndiod/listen.h b/usr.bin/sndiod/listen.h
index d1090949e62..cfef5c4d1a7 100644
--- a/usr.bin/sndiod/listen.h
+++ b/usr.bin/sndiod/listen.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: listen.h,v 1.1 2012/11/23 07:03:28 ratchov Exp $ */
+/* $OpenBSD: listen.h,v 1.2 2015/12/14 17:44:29 ratchov Exp $ */
/*
* Copyright (c) 2008-2012 Alexandre Ratchov <alex@caoua.org>
*
@@ -24,6 +24,7 @@ struct listen {
struct file *file;
char *path;
int fd;
+ int slowaccept;
};
extern struct listen *listen_list;