summaryrefslogtreecommitdiff
path: root/usr.sbin/smtpd/mfa.c
diff options
context:
space:
mode:
authorJacek Masiulaniec <jacekm@cvs.openbsd.org>2009-06-01 13:20:57 +0000
committerJacek Masiulaniec <jacekm@cvs.openbsd.org>2009-06-01 13:20:57 +0000
commiteb2c7fd4c525dbce423339d737b86ed9c30b308c (patch)
tree1306a31f459c4a6f982847eeff0325074918ce4c /usr.sbin/smtpd/mfa.c
parentfc7678b4f83d3e3982caba2cb908da6fc28b788f (diff)
Fix EV_READ/EV_WRITE testing inside IMSG handlers. Based on similar change
to the routing daemons by claudio@; ok gilles@
Diffstat (limited to 'usr.sbin/smtpd/mfa.c')
-rw-r--r--usr.sbin/smtpd/mfa.c54
1 files changed, 21 insertions, 33 deletions
diff --git a/usr.sbin/smtpd/mfa.c b/usr.sbin/smtpd/mfa.c
index 97759962d46..26c55b382e7 100644
--- a/usr.sbin/smtpd/mfa.c
+++ b/usr.sbin/smtpd/mfa.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mfa.c,v 1.31 2009/05/24 14:38:56 jacekm Exp $ */
+/* $OpenBSD: mfa.c,v 1.32 2009/06/01 13:20:56 jacekm Exp $ */
/*
* Copyright (c) 2008 Gilles Chehade <gilles@openbsd.org>
@@ -76,8 +76,8 @@ mfa_dispatch_parent(int sig, short event, void *p)
ssize_t n;
ibuf = env->sc_ibufs[PROC_PARENT];
- switch (event) {
- case EV_READ:
+
+ if (event & EV_READ) {
if ((n = imsg_read(ibuf)) == -1)
fatal("imsg_read_error");
if (n == 0) {
@@ -86,14 +86,11 @@ mfa_dispatch_parent(int sig, short event, void *p)
event_loopexit(NULL);
return;
}
- break;
- case EV_WRITE:
+ }
+
+ if (event & EV_WRITE) {
if (msgbuf_write(&ibuf->w) == -1)
fatal("msgbuf_write");
- imsg_event_add(ibuf);
- return;
- default:
- fatalx("unknown event");
}
for (;;) {
@@ -243,8 +240,8 @@ mfa_dispatch_smtp(int sig, short event, void *p)
ssize_t n;
ibuf = env->sc_ibufs[PROC_SMTP];
- switch (event) {
- case EV_READ:
+
+ if (event & EV_READ) {
if ((n = imsg_read(ibuf)) == -1)
fatal("imsg_read_error");
if (n == 0) {
@@ -253,14 +250,11 @@ mfa_dispatch_smtp(int sig, short event, void *p)
event_loopexit(NULL);
return;
}
- break;
- case EV_WRITE:
+ }
+
+ if (event & EV_WRITE) {
if (msgbuf_write(&ibuf->w) == -1)
fatal("msgbuf_write");
- imsg_event_add(ibuf);
- return;
- default:
- fatalx("unknown event");
}
for (;;) {
@@ -307,8 +301,8 @@ mfa_dispatch_lka(int sig, short event, void *p)
ssize_t n;
ibuf = env->sc_ibufs[PROC_LKA];
- switch (event) {
- case EV_READ:
+
+ if (event & EV_READ) {
if ((n = imsg_read(ibuf)) == -1)
fatal("imsg_read_error");
if (n == 0) {
@@ -317,14 +311,11 @@ mfa_dispatch_lka(int sig, short event, void *p)
event_loopexit(NULL);
return;
}
- break;
- case EV_WRITE:
+ }
+
+ if (event & EV_WRITE) {
if (msgbuf_write(&ibuf->w) == -1)
fatal("msgbuf_write");
- imsg_event_add(ibuf);
- return;
- default:
- fatalx("unknown event");
}
for (;;) {
@@ -371,8 +362,8 @@ mfa_dispatch_control(int sig, short event, void *p)
ssize_t n;
ibuf = env->sc_ibufs[PROC_CONTROL];
- switch (event) {
- case EV_READ:
+
+ if (event & EV_READ) {
if ((n = imsg_read(ibuf)) == -1)
fatal("imsg_read_error");
if (n == 0) {
@@ -381,14 +372,11 @@ mfa_dispatch_control(int sig, short event, void *p)
event_loopexit(NULL);
return;
}
- break;
- case EV_WRITE:
+ }
+
+ if (event & EV_WRITE) {
if (msgbuf_write(&ibuf->w) == -1)
fatal("msgbuf_write");
- imsg_event_add(ibuf);
- return;
- default:
- fatalx("unknown event");
}
for (;;) {