-/* $OpenBSD: ldapclient.c,v 1.29 2014/07/13 12:07:59 krw Exp $ */
+/* $OpenBSD: ldapclient.c,v 1.30 2014/07/13 15:38:09 krw Exp $ */
/*
* Copyright (c) 2008 Alexander Schrijver <aschrijver@openbsd.org>
}
void
-client_dispatch_dns(int fd, short event, void *p)
+client_dispatch_dns(int fd, short events, void *p)
{
struct imsg imsg;
u_int16_t dlen;
struct imsgev *iev = env->sc_iev_dns;
struct imsgbuf *ibuf = &iev->ibuf;
- switch (event) {
- case EV_READ:
+ if ((events & (EV_READ | EV_WRITE)) == 0)
+ fatalx("unknown event");
+
+ if (events & EV_READ) {
if ((n = imsg_read(ibuf)) == -1)
fatal("imsg_read error");
if (n == 0)
shut = 1;
- break;
- case EV_WRITE:
+ }
+ if (events & EV_WRITE) {
if ((n = msgbuf_write(&ibuf->w)) == -1 && errno != EAGAIN)
fatal("msgbuf_write");
if (n == 0)
shut = 1;
goto done;
- default:
- fatalx("unknown event");
}
for (;;) {
}
void
-client_dispatch_parent(int fd, short event, void *p)
+client_dispatch_parent(int fd, short events, void *p)
{
int n;
int shut = 0;
struct imsgev *iev = env->sc_iev;
struct imsgbuf *ibuf = &iev->ibuf;
+ if ((events & (EV_READ | EV_WRITE)) == 0)
+ fatalx("unknown event");
- switch (event) {
- case EV_READ:
+ if (events & EV_READ) {
if ((n = imsg_read(ibuf)) == -1)
fatal("imsg_read error");
if (n == 0)
shut = 1;
- break;
- case EV_WRITE:
+ }
+ if (events & EV_WRITE) {
if ((n = msgbuf_write(&ibuf->w)) == -1 && errno != EAGAIN)
fatal("msgbuf_write");
if (n == 0)
shut = 1;
goto done;
- default:
- fatalx("unknown event");
}
for (;;) {
-/* $OpenBSD: ypldap.c,v 1.13 2014/07/13 12:07:59 krw Exp $ */
+/* $OpenBSD: ypldap.c,v 1.14 2014/07/13 15:38:09 krw Exp $ */
/*
* Copyright (c) 2008 Pierre-Yves Ritschard <pyr@openbsd.org>
}
void
-main_dispatch_client(int fd, short event, void *p)
+main_dispatch_client(int fd, short events, void *p)
{
int n;
int shut = 0;
struct idm_req ir;
struct imsg imsg;
- switch (event) {
- case EV_READ:
+ if ((events & (EV_READ | EV_WRITE)) == 0)
+ fatalx("unknown event");
+
+ if (events & EV_READ) {
if ((n = imsg_read(ibuf)) == -1)
fatal("imsg_read error");
if (n == 0)
shut = 1;
- break;
- case EV_WRITE:
+ }
+ if (events & EV_WRITE) {
if ((n = msgbuf_write(&ibuf->w)) == -1 && errno != EAGAIN)
fatal("msgbuf_write");
if (n == 0)
shut = 1;
goto done;
- default:
- fatalx("unknown event");
}
for (;;) {
-/* $OpenBSD: ypldap_dns.c,v 1.6 2014/07/13 12:07:59 krw Exp $ */
+/* $OpenBSD: ypldap_dns.c,v 1.7 2014/07/13 15:38:09 krw Exp $ */
/*
* Copyright (c) 2003-2008 Henning Brauer <henning@openbsd.org>
}
void
-dns_dispatch_imsg(int fd, short event, void *p)
+dns_dispatch_imsg(int fd, short events, void *p)
{
struct imsg imsg;
int n, cnt;
struct imsgbuf *ibuf = &iev->ibuf;
int shut = 0;
- switch (event) {
- case EV_READ:
+ if ((events & (EV_READ | EV_WRITE)) == 0)
+ fatalx("unknown event");
+
+ if (events & EV_READ) {
if ((n = imsg_read(ibuf)) == -1)
fatal("imsg_read error");
if (n == 0)
shut = 1;
- break;
- case EV_WRITE:
+ }
+ if (events & EV_WRITE) {
if ((n = msgbuf_write(&ibuf->w)) == -1 && errno != EAGAIN)
fatal("msgbuf_write");
if (n == 0)
shut = 1;
goto done;
- default:
- fatalx("unknown event");
}
for (;;) {