diff options
author | Claudio Jeker <claudio@cvs.openbsd.org> | 2007-07-25 19:11:28 +0000 |
---|---|---|
committer | Claudio Jeker <claudio@cvs.openbsd.org> | 2007-07-25 19:11:28 +0000 |
commit | f87c0abacee8e961fce6f6fab542f60d5d614025 (patch) | |
tree | 0d031c2abc7d7876ea317043f2e668cfe90edd5e /usr.sbin/ospfd/ospfd.c | |
parent | d417b66f59a15a5aea30d31a19cd577ae3cde834 (diff) |
Don't fatal if the imsg pipe is closed, this is often triggered in the parent
and hides the real cause of the termination.
OK norby@, reyk@, pyr@
Diffstat (limited to 'usr.sbin/ospfd/ospfd.c')
-rw-r--r-- | usr.sbin/ospfd/ospfd.c | 24 |
1 files changed, 19 insertions, 5 deletions
diff --git a/usr.sbin/ospfd/ospfd.c b/usr.sbin/ospfd/ospfd.c index 523b6367792..4f3bf3d274f 100644 --- a/usr.sbin/ospfd/ospfd.c +++ b/usr.sbin/ospfd/ospfd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ospfd.c,v 1.47 2007/06/19 14:42:09 pyr Exp $ */ +/* $OpenBSD: ospfd.c,v 1.48 2007/07/25 19:11:27 claudio Exp $ */ /* * Copyright (c) 2005 Claudio Jeker <claudio@openbsd.org> @@ -347,13 +347,14 @@ main_dispatch_ospfe(int fd, short event, void *bula) struct imsg imsg; struct demote_msg dmsg; 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) @@ -409,7 +410,13 @@ main_dispatch_ospfe(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 */ @@ -419,13 +426,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) @@ -461,7 +469,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 |