diff options
Diffstat (limited to 'usr.sbin/ospf6d')
-rw-r--r-- | usr.sbin/ospf6d/control.c | 14 | ||||
-rw-r--r-- | usr.sbin/ospf6d/ospf6d.c | 22 | ||||
-rw-r--r-- | usr.sbin/ospf6d/ospfe.c | 22 | ||||
-rw-r--r-- | usr.sbin/ospf6d/rde.c | 22 |
4 files changed, 26 insertions, 54 deletions
diff --git a/usr.sbin/ospf6d/control.c b/usr.sbin/ospf6d/control.c index e9e61206eba..778c6b7bb1e 100644 --- a/usr.sbin/ospf6d/control.c +++ b/usr.sbin/ospf6d/control.c @@ -1,4 +1,4 @@ -/* $OpenBSD: control.c,v 1.7 2009/02/25 17:09:55 claudio Exp $ */ +/* $OpenBSD: control.c,v 1.8 2009/05/31 17:00:40 claudio Exp $ */ /* * Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org> @@ -196,22 +196,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/ospf6d/ospf6d.c b/usr.sbin/ospf6d/ospf6d.c index 7b874ad2b1c..870035d00b2 100644 --- a/usr.sbin/ospf6d/ospf6d.c +++ b/usr.sbin/ospf6d/ospf6d.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ospf6d.c,v 1.12 2009/03/28 15:38:58 michele Exp $ */ +/* $OpenBSD: ospf6d.c,v 1.13 2009/05/31 17:00:40 claudio Exp $ */ /* * Copyright (c) 2005 Claudio Jeker <claudio@openbsd.org> @@ -352,20 +352,16 @@ main_dispatch_ospfe(int fd, short event, void *bula) ssize_t n; int shut = 0; - switch (event) { - case EV_READ: + if (event & EV_READ) { if ((n = imsg_read(ibuf)) == -1) fatal("imsg_read error"); if (n == 0) /* connection closed */ shut = 1; - 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 (;;) { @@ -423,20 +419,16 @@ main_dispatch_rde(int fd, short event, void *bula) ssize_t n; int shut = 0; - switch (event) { - case EV_READ: + if (event & EV_READ) { if ((n = imsg_read(ibuf)) == -1) fatal("imsg_read error"); if (n == 0) /* connection closed */ shut = 1; - 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/ospf6d/ospfe.c b/usr.sbin/ospf6d/ospfe.c index 307238956da..62f0e6122fc 100644 --- a/usr.sbin/ospf6d/ospfe.c +++ b/usr.sbin/ospf6d/ospfe.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ospfe.c,v 1.25 2009/03/29 19:02:58 stsp Exp $ */ +/* $OpenBSD: ospfe.c,v 1.26 2009/05/31 17:00:40 claudio Exp $ */ /* * Copyright (c) 2005 Claudio Jeker <claudio@openbsd.org> @@ -253,20 +253,16 @@ ospfe_dispatch_main(int fd, short event, void *bula) int n, stub_changed, shut = 0; unsigned int ifindex; - switch (event) { - case EV_READ: + if (event & EV_READ) { if ((n = imsg_read(ibuf)) == -1) fatal("imsg_read error"); if (n == 0) /* connection closed */ shut = 1; - 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 (;;) { @@ -391,20 +387,16 @@ ospfe_dispatch_rde(int fd, short event, void *bula) int n, noack = 0, shut = 0; u_int16_t l, age; - switch (event) { - case EV_READ: + if (event & EV_READ) { if ((n = imsg_read(ibuf)) == -1) fatal("imsg_read error"); if (n == 0) /* connection closed */ shut = 1; - 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/ospf6d/rde.c b/usr.sbin/ospf6d/rde.c index 3ea41cbe248..20b27a5aaf1 100644 --- a/usr.sbin/ospf6d/rde.c +++ b/usr.sbin/ospf6d/rde.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rde.c,v 1.28 2009/04/09 19:00:40 stsp Exp $ */ +/* $OpenBSD: rde.c,v 1.29 2009/05/31 17:00:40 claudio Exp $ */ /* * Copyright (c) 2004, 2005 Claudio Jeker <claudio@openbsd.org> @@ -255,20 +255,16 @@ rde_dispatch_imsg(int fd, short event, void *bula) int r, state, self, shut = 0; u_int16_t l; - switch (event) { - case EV_READ: + if (event & EV_READ) { if ((n = imsg_read(ibuf)) == -1) fatal("imsg_read error"); if (n == 0) /* connection closed */ shut = 1; - 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"); } clock_gettime(CLOCK_MONOTONIC, &tp); @@ -628,20 +624,16 @@ rde_dispatch_parent(int fd, short event, void *bula) int shut = 0; unsigned int ifindex; - switch (event) { - case EV_READ: + if (event & EV_READ) { if ((n = imsg_read(ibuf)) == -1) fatal("imsg_read error"); if (n == 0) /* connection closed */ shut = 1; - 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 (;;) { |