diff options
author | claudio <claudio@openbsd.org> | 2007-10-24 19:05:06 +0000 |
---|---|---|
committer | claudio <claudio@openbsd.org> | 2007-10-24 19:05:06 +0000 |
commit | 2a8226da3c2cae26cb00c3d32b45b8310522dfa8 (patch) | |
tree | b77e441adb085cff2cf437193f8a6a701045a9e8 /usr.sbin/ripd/ripd.c | |
parent | Uncomment PECI mode diagnosting bits. (diff) | |
download | wireguard-openbsd-2a8226da3c2cae26cb00c3d32b45b8310522dfa8.tar.xz wireguard-openbsd-2a8226da3c2cae26cb00c3d32b45b8310522dfa8.zip |
Sync a bit more with ospfd. Do not fatal if one of the pipes is closed,
instead do a "nice" shutdown. Ignore SIGHUP in the childs even though we
have no reload support (yet). Remove some redundant code and clean up some
types.
Diffstat (limited to 'usr.sbin/ripd/ripd.c')
-rw-r--r-- | usr.sbin/ripd/ripd.c | 24 |
1 files changed, 19 insertions, 5 deletions
diff --git a/usr.sbin/ripd/ripd.c b/usr.sbin/ripd/ripd.c index 3ba9406f1ba..6acca39ce2b 100644 --- a/usr.sbin/ripd/ripd.c +++ b/usr.sbin/ripd/ripd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ripd.c,v 1.6 2007/10/20 13:26:50 pyr Exp $ */ +/* $OpenBSD: ripd.c,v 1.7 2007/10/24 19:05:06 claudio Exp $ */ /* * Copyright (c) 2006 Michele Marchetto <mydecay@openbeer.it> @@ -327,13 +327,14 @@ main_dispatch_ripe(int fd, short event, void *bula) struct imsgbuf *ibuf = bula; struct imsg imsg; ssize_t n; + int shut = 0; switch (event) { case EV_READ: if ((n = imsg_read(ibuf)) == -1) fatal("imsg_read error"); if (n == 0) /* connection closed */ - fatalx("pipe closed"); + shut = 1; break; case EV_WRITE: if (msgbuf_write(&ibuf->w) == -1) @@ -380,7 +381,13 @@ main_dispatch_ripe(int fd, short event, void *bula) } imsg_free(&imsg); } - imsg_event_add(ibuf); + if (!shut) + imsg_event_add(ibuf); + else { + /* this pipe is dead, so remove the event handler */ + event_del(&ibuf->ev); + event_loopexit(NULL); + } } /* ARGSUSED */ @@ -390,13 +397,14 @@ main_dispatch_rde(int fd, short event, void *bula) struct imsgbuf *ibuf = bula; struct imsg imsg; ssize_t n; + int shut = 0; switch (event) { case EV_READ: if ((n = imsg_read(ibuf)) == -1) fatal("imsg_read error"); if (n == 0) /* connection closed */ - fatalx("pipe closed"); + shut = 1; break; case EV_WRITE: if (msgbuf_write(&ibuf->w) == -1) @@ -432,7 +440,13 @@ main_dispatch_rde(int fd, short event, void *bula) } imsg_free(&imsg); } - imsg_event_add(ibuf); + if (!shut) + imsg_event_add(ibuf); + else { + /* this pipe is dead, so remove the event handler */ + event_del(&ibuf->ev); + event_loopexit(NULL); + } } void |