diff options
author | Jacek Masiulaniec <jacekm@cvs.openbsd.org> | 2009-06-01 13:20:57 +0000 |
---|---|---|
committer | Jacek Masiulaniec <jacekm@cvs.openbsd.org> | 2009-06-01 13:20:57 +0000 |
commit | eb2c7fd4c525dbce423339d737b86ed9c30b308c (patch) | |
tree | 1306a31f459c4a6f982847eeff0325074918ce4c /usr.sbin/smtpd/queue.c | |
parent | fc7678b4f83d3e3982caba2cb908da6fc28b788f (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/queue.c')
-rw-r--r-- | usr.sbin/smtpd/queue.c | 80 |
1 files changed, 31 insertions, 49 deletions
diff --git a/usr.sbin/smtpd/queue.c b/usr.sbin/smtpd/queue.c index d8798802375..cb25bdc7a0f 100644 --- a/usr.sbin/smtpd/queue.c +++ b/usr.sbin/smtpd/queue.c @@ -1,4 +1,4 @@ -/* $OpenBSD: queue.c,v 1.65 2009/05/24 14:38:56 jacekm Exp $ */ +/* $OpenBSD: queue.c,v 1.66 2009/06/01 13:20:56 jacekm Exp $ */ /* * Copyright (c) 2008 Gilles Chehade <gilles@openbsd.org> @@ -78,8 +78,8 @@ queue_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) { @@ -88,14 +88,11 @@ queue_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 (;;) { @@ -124,8 +121,8 @@ queue_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) { @@ -134,14 +131,11 @@ queue_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 (;;) { @@ -261,8 +255,8 @@ queue_dispatch_mda(int sig, short event, void *p) ssize_t n; ibuf = env->sc_ibufs[PROC_MDA]; - switch (event) { - case EV_READ: + + if (event & EV_READ) { if ((n = imsg_read(ibuf)) == -1) fatal("imsg_read_error"); if (n == 0) { @@ -271,14 +265,11 @@ queue_dispatch_mda(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 (;;) { @@ -313,8 +304,8 @@ queue_dispatch_mta(int sig, short event, void *p) ssize_t n; ibuf = env->sc_ibufs[PROC_MTA]; - switch (event) { - case EV_READ: + + if (event & EV_READ) { if ((n = imsg_read(ibuf)) == -1) fatal("imsg_read_error"); if (n == 0) { @@ -323,14 +314,11 @@ queue_dispatch_mta(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 (;;) { @@ -377,8 +365,8 @@ queue_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) { @@ -387,14 +375,11 @@ queue_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 (;;) { @@ -470,8 +455,8 @@ queue_dispatch_runner(int sig, short event, void *p) ssize_t n; ibuf = env->sc_ibufs[PROC_RUNNER]; - switch (event) { - case EV_READ: + + if (event & EV_READ) { if ((n = imsg_read(ibuf)) == -1) fatal("imsg_read_error"); if (n == 0) { @@ -480,14 +465,11 @@ queue_dispatch_runner(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 (;;) { |