summaryrefslogtreecommitdiff
path: root/usr.sbin/smtpd/smtp.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/smtp.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/smtp.c')
-rw-r--r--usr.sbin/smtpd/smtp.c67
1 files changed, 26 insertions, 41 deletions
diff --git a/usr.sbin/smtpd/smtp.c b/usr.sbin/smtpd/smtp.c
index d1f353e52a5..7a09bfe1a81 100644
--- a/usr.sbin/smtpd/smtp.c
+++ b/usr.sbin/smtpd/smtp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: smtp.c,v 1.52 2009/05/25 14:00:36 jacekm Exp $ */
+/* $OpenBSD: smtp.c,v 1.53 2009/06/01 13:20:56 jacekm Exp $ */
/*
* Copyright (c) 2008 Gilles Chehade <gilles@openbsd.org>
@@ -74,8 +74,8 @@ smtp_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) {
@@ -84,14 +84,11 @@ smtp_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 (;;) {
@@ -219,8 +216,8 @@ smtp_dispatch_mfa(int sig, short event, void *p)
ssize_t n;
ibuf = env->sc_ibufs[PROC_MFA];
- switch (event) {
- case EV_READ:
+
+ if (event & EV_READ) {
if ((n = imsg_read(ibuf)) == -1)
fatal("imsg_read_error");
if (n == 0) {
@@ -229,14 +226,11 @@ smtp_dispatch_mfa(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 (;;) {
@@ -280,8 +274,8 @@ smtp_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) {
@@ -290,14 +284,11 @@ smtp_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 (;;) {
@@ -350,8 +341,8 @@ smtp_dispatch_queue(int sig, short event, void *p)
ssize_t n;
ibuf = env->sc_ibufs[PROC_QUEUE];
- switch (event) {
- case EV_READ:
+
+ if (event & EV_READ) {
if ((n = imsg_read(ibuf)) == -1)
fatal("imsg_read_error");
if (n == 0) {
@@ -360,14 +351,11 @@ smtp_dispatch_queue(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 (;;) {
@@ -477,8 +465,8 @@ smtp_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) {
@@ -487,14 +475,11 @@ smtp_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 (;;) {