summaryrefslogtreecommitdiff
path: root/usr.sbin/snmpd/control.c
diff options
context:
space:
mode:
authorYASUOKA Masahiko <yasuoka@cvs.openbsd.org>2014-06-03 06:25:48 +0000
committerYASUOKA Masahiko <yasuoka@cvs.openbsd.org>2014-06-03 06:25:48 +0000
commitc710bfb2428ee884bc0bfcb97cfa38b4a60c2db3 (patch)
tree56815fe68ec6ce276cf42f16311398403da32166 /usr.sbin/snmpd/control.c
parent871cfbafd9c356ec33240b16ae35507365683073 (diff)
Handle the event parameter of libevent callback function as a bit
mask. Also remove redundant imsg_event_add calls. Fixes come from usr.sbin/ospfd/control.c ok reyk
Diffstat (limited to 'usr.sbin/snmpd/control.c')
-rw-r--r--usr.sbin/snmpd/control.c12
1 files changed, 4 insertions, 8 deletions
diff --git a/usr.sbin/snmpd/control.c b/usr.sbin/snmpd/control.c
index f0e409ca2a9..8e613a2ba25 100644
--- a/usr.sbin/snmpd/control.c
+++ b/usr.sbin/snmpd/control.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: control.c,v 1.24 2014/04/25 11:12:14 blambert Exp $ */
+/* $OpenBSD: control.c,v 1.25 2014/06/03 06:25:47 yasuoka Exp $ */
/*
* Copyright (c) 2010-2013 Reyk Floeter <reyk@openbsd.org>
@@ -231,21 +231,17 @@ control_dispatch_imsg(int fd, short event, void *arg)
struct imsg imsg;
int n, v, i;
- switch (event) {
- case EV_READ:
+ if (event & EV_READ) {
if ((n = imsg_read(&c->iev.ibuf)) == -1 || n == 0) {
control_close(c);
return;
}
- break;
- case EV_WRITE:
+ }
+ if (event & EV_WRITE) {
if (msgbuf_write(&c->iev.ibuf.w) < 0 && errno != EAGAIN) {
control_close(c);
return;
}
- break;
- default:
- fatalx("unknown event");
}
for (;;) {