diff options
author | Claudio Jeker <claudio@cvs.openbsd.org> | 2009-05-31 17:13:05 +0000 |
---|---|---|
committer | Claudio Jeker <claudio@cvs.openbsd.org> | 2009-05-31 17:13:05 +0000 |
commit | 27c775ee9dc631b95ec2a1f83dad749c8ee5d8bb (patch) | |
tree | 43bb57e81aa795866deb3e40e83a91b0a570a3a3 /usr.sbin | |
parent | e7efeba3453124e29efa6e347ad74898bd0b4ccd (diff) |
More libevent callback fixes. While there make n also ssize_t as in all
other daemons.
Diffstat (limited to 'usr.sbin')
-rw-r--r-- | usr.sbin/dvmrpd/control.c | 14 | ||||
-rw-r--r-- | usr.sbin/dvmrpd/dvmrpd.c | 26 | ||||
-rw-r--r-- | usr.sbin/dvmrpd/dvmrpe.c | 26 | ||||
-rw-r--r-- | usr.sbin/dvmrpd/rde.c | 15 |
4 files changed, 29 insertions, 52 deletions
diff --git a/usr.sbin/dvmrpd/control.c b/usr.sbin/dvmrpd/control.c index f078914ec6c..5ed8a7ea6fc 100644 --- a/usr.sbin/dvmrpd/control.c +++ b/usr.sbin/dvmrpd/control.c @@ -1,4 +1,4 @@ -/* $OpenBSD: control.c,v 1.5 2009/02/25 17:09:55 claudio Exp $ */ +/* $OpenBSD: control.c,v 1.6 2009/05/31 17:13:04 claudio Exp $ */ /* * Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org> @@ -198,22 +198,18 @@ control_dispatch_imsg(int fd, short event, void *bula) return; } - switch (event) { - case EV_READ: + if (event & EV_READ) { if ((n = imsg_read(&c->ibuf)) == -1 || n == 0) { control_close(fd); return; } - break; - case EV_WRITE: - if (msgbuf_write(&c->ibuf.w) < 0) { + } + if (event & EV_WRITE) { + if (msgbuf_write(&c->ibuf.w) == -1) { control_close(fd); return; } imsg_event_add(&c->ibuf); - return; - default: - fatalx("unknown event"); } for (;;) { diff --git a/usr.sbin/dvmrpd/dvmrpd.c b/usr.sbin/dvmrpd/dvmrpd.c index bf134b9f148..5b416a010ac 100644 --- a/usr.sbin/dvmrpd/dvmrpd.c +++ b/usr.sbin/dvmrpd/dvmrpd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dvmrpd.c,v 1.6 2008/05/12 19:15:02 pyr Exp $ */ +/* $OpenBSD: dvmrpd.c,v 1.7 2009/05/31 17:13:04 claudio Exp $ */ /* * Copyright (c) 2005 Claudio Jeker <claudio@openbsd.org> @@ -352,22 +352,18 @@ main_dispatch_dvmrpe(int fd, short event, void *bula) { struct imsgbuf *ibuf = bula; struct imsg imsg; - int n; + ssize_t n; - switch (event) { - case EV_READ: + if (event & EV_READ) { if ((n = imsg_read(ibuf)) == -1) fatal("imsg_read error"); if (n == 0) /* connection closed */ fatalx("pipe closed"); - 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 (;;) { @@ -404,22 +400,18 @@ main_dispatch_rde(int fd, short event, void *bula) struct mfc mfc; struct imsgbuf *ibuf = bula; struct imsg imsg; - int n; + ssize_t n; - switch (event) { - case EV_READ: + if (event & EV_READ) { if ((n = imsg_read(ibuf)) == -1) fatal("imsg_read error"); if (n == 0) /* connection closed */ fatalx("pipe closed"); - 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 (;;) { diff --git a/usr.sbin/dvmrpd/dvmrpe.c b/usr.sbin/dvmrpd/dvmrpe.c index 931e5b6c45d..4179263bc51 100644 --- a/usr.sbin/dvmrpd/dvmrpe.c +++ b/usr.sbin/dvmrpd/dvmrpe.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dvmrpe.c,v 1.4 2009/03/14 15:32:55 michele Exp $ */ +/* $OpenBSD: dvmrpe.c,v 1.5 2009/05/31 17:13:04 claudio Exp $ */ /* * Copyright (c) 2005 Claudio Jeker <claudio@openbsd.org> @@ -231,22 +231,18 @@ dvmrpe_dispatch_main(int fd, short event, void *bula) { struct imsg imsg; struct imsgbuf *ibuf = bula; - int n; + ssize_t n; - switch (event) { - case EV_READ: + if (event & EV_READ) { if ((n = imsg_read(ibuf)) == -1) fatal("imsg_read error"); if (n == 0) /* connection closed */ fatalx("pipe closed"); - 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 (;;) { @@ -275,22 +271,18 @@ dvmrpe_dispatch_rde(int fd, short event, void *bula) struct prune p; struct iface *iface; struct route_report *rr; - int n; + ssize_t n; - switch (event) { - case EV_READ: + if (event & EV_READ) { if ((n = imsg_read(ibuf)) == -1) fatal("imsg_read error"); if (n == 0) /* connection closed */ fatalx("pipe closed"); - 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 (;;) { diff --git a/usr.sbin/dvmrpd/rde.c b/usr.sbin/dvmrpd/rde.c index fdeb3b9d7ca..abf07d7e363 100644 --- a/usr.sbin/dvmrpd/rde.c +++ b/usr.sbin/dvmrpd/rde.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rde.c,v 1.16 2009/05/20 16:10:04 michele Exp $ */ +/* $OpenBSD: rde.c,v 1.17 2009/05/31 17:13:04 claudio Exp $ */ /* * Copyright (c) 2004, 2005 Claudio Jeker <claudio@openbsd.org> @@ -194,23 +194,20 @@ rde_dispatch_imsg(int fd, short event, void *bula) struct imsg imsg; struct route_report rr; struct nbr_msg nm; - int i, n, connected = 0; + int i, connected = 0; + ssize_t n; struct iface *iface; - switch (event) { - case EV_READ: + if (event & EV_READ) { if ((n = imsg_read(ibuf)) == -1) fatal("imsg_read error"); if (n == 0) /* connection closed */ fatalx("pipe closed"); - 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 (;;) { |