diff options
author | Nicholas Marriott <nicm@cvs.openbsd.org> | 2009-08-08 18:33:41 +0000 |
---|---|---|
committer | Nicholas Marriott <nicm@cvs.openbsd.org> | 2009-08-08 18:33:41 +0000 |
commit | 45cf1594f717b07d27721e90d7afa7b7a1171424 (patch) | |
tree | f9b348837314e441dbe90698f84af7e933ba5ec8 | |
parent | 73bc8536f568c8dfe3319d3e30304246ac831856 (diff) |
Make imsg_clear close and free any fds in the received fd queue as well as
freeing the msgbuf.
While here also remove an unnecessary while loop.
ok eric pyr
-rw-r--r-- | usr.sbin/bgpd/imsg.c | 9 | ||||
-rw-r--r-- | usr.sbin/dvmrpd/imsg.c | 9 | ||||
-rw-r--r-- | usr.sbin/ldpd/imsg.c | 9 | ||||
-rw-r--r-- | usr.sbin/ntpd/imsg.c | 9 | ||||
-rw-r--r-- | usr.sbin/ospf6d/imsg.c | 9 | ||||
-rw-r--r-- | usr.sbin/ospfd/imsg.c | 9 | ||||
-rw-r--r-- | usr.sbin/relayd/imsg.c | 9 | ||||
-rw-r--r-- | usr.sbin/ripd/imsg.c | 9 | ||||
-rw-r--r-- | usr.sbin/smtpd/imsg.c | 9 | ||||
-rw-r--r-- | usr.sbin/snmpd/imsg.c | 9 | ||||
-rw-r--r-- | usr.sbin/ypldap/imsg.c | 9 |
11 files changed, 66 insertions, 33 deletions
diff --git a/usr.sbin/bgpd/imsg.c b/usr.sbin/bgpd/imsg.c index 3ba224ee468..39dccce04b8 100644 --- a/usr.sbin/bgpd/imsg.c +++ b/usr.sbin/bgpd/imsg.c @@ -1,4 +1,4 @@ -/* $OpenBSD: imsg.c,v 1.47 2009/06/08 08:30:06 dlg Exp $ */ +/* $OpenBSD: imsg.c,v 1.48 2009/08/08 18:33:40 nicm Exp $ */ /* * Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org> @@ -263,6 +263,9 @@ imsg_flush(struct imsgbuf *ibuf) void imsg_clear(struct imsgbuf *ibuf) { - while (ibuf->w.queued) - msgbuf_clear(&ibuf->w); + int fd; + + msgbuf_clear(&ibuf->w); + while ((fd = imsg_get_fd(ibuf)) != -1) + close(fd); } diff --git a/usr.sbin/dvmrpd/imsg.c b/usr.sbin/dvmrpd/imsg.c index 7a8184a8571..83acd42c025 100644 --- a/usr.sbin/dvmrpd/imsg.c +++ b/usr.sbin/dvmrpd/imsg.c @@ -1,4 +1,4 @@ -/* $OpenBSD: imsg.c,v 1.7 2009/06/08 08:30:06 dlg Exp $ */ +/* $OpenBSD: imsg.c,v 1.8 2009/08/08 18:33:40 nicm Exp $ */ /* * Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org> @@ -263,6 +263,9 @@ imsg_flush(struct imsgbuf *ibuf) void imsg_clear(struct imsgbuf *ibuf) { - while (ibuf->w.queued) - msgbuf_clear(&ibuf->w); + int fd; + + msgbuf_clear(&ibuf->w); + while ((fd = imsg_get_fd(ibuf)) != -1) + close(fd); } diff --git a/usr.sbin/ldpd/imsg.c b/usr.sbin/ldpd/imsg.c index d6e6c890a19..51e0bbe4b77 100644 --- a/usr.sbin/ldpd/imsg.c +++ b/usr.sbin/ldpd/imsg.c @@ -1,4 +1,4 @@ -/* $OpenBSD: imsg.c,v 1.6 2009/06/08 08:30:06 dlg Exp $ */ +/* $OpenBSD: imsg.c,v 1.7 2009/08/08 18:33:40 nicm Exp $ */ /* * Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org> @@ -263,6 +263,9 @@ imsg_flush(struct imsgbuf *ibuf) void imsg_clear(struct imsgbuf *ibuf) { - while (ibuf->w.queued) - msgbuf_clear(&ibuf->w); + int fd; + + msgbuf_clear(&ibuf->w); + while ((fd = imsg_get_fd(ibuf)) != -1) + close(fd); } diff --git a/usr.sbin/ntpd/imsg.c b/usr.sbin/ntpd/imsg.c index 8ae9f2271f5..737175b8152 100644 --- a/usr.sbin/ntpd/imsg.c +++ b/usr.sbin/ntpd/imsg.c @@ -1,4 +1,4 @@ -/* $OpenBSD: imsg.c,v 1.17 2009/06/08 08:30:06 dlg Exp $ */ +/* $OpenBSD: imsg.c,v 1.18 2009/08/08 18:33:40 nicm Exp $ */ /* * Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org> @@ -263,6 +263,9 @@ imsg_flush(struct imsgbuf *ibuf) void imsg_clear(struct imsgbuf *ibuf) { - while (ibuf->w.queued) - msgbuf_clear(&ibuf->w); + int fd; + + msgbuf_clear(&ibuf->w); + while ((fd = imsg_get_fd(ibuf)) != -1) + close(fd); } diff --git a/usr.sbin/ospf6d/imsg.c b/usr.sbin/ospf6d/imsg.c index d6e6c890a19..51e0bbe4b77 100644 --- a/usr.sbin/ospf6d/imsg.c +++ b/usr.sbin/ospf6d/imsg.c @@ -1,4 +1,4 @@ -/* $OpenBSD: imsg.c,v 1.6 2009/06/08 08:30:06 dlg Exp $ */ +/* $OpenBSD: imsg.c,v 1.7 2009/08/08 18:33:40 nicm Exp $ */ /* * Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org> @@ -263,6 +263,9 @@ imsg_flush(struct imsgbuf *ibuf) void imsg_clear(struct imsgbuf *ibuf) { - while (ibuf->w.queued) - msgbuf_clear(&ibuf->w); + int fd; + + msgbuf_clear(&ibuf->w); + while ((fd = imsg_get_fd(ibuf)) != -1) + close(fd); } diff --git a/usr.sbin/ospfd/imsg.c b/usr.sbin/ospfd/imsg.c index 1dafca32a90..dcc257c13f0 100644 --- a/usr.sbin/ospfd/imsg.c +++ b/usr.sbin/ospfd/imsg.c @@ -1,4 +1,4 @@ -/* $OpenBSD: imsg.c,v 1.18 2009/06/08 08:30:06 dlg Exp $ */ +/* $OpenBSD: imsg.c,v 1.19 2009/08/08 18:33:40 nicm Exp $ */ /* * Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org> @@ -263,6 +263,9 @@ imsg_flush(struct imsgbuf *ibuf) void imsg_clear(struct imsgbuf *ibuf) { - while (ibuf->w.queued) - msgbuf_clear(&ibuf->w); + int fd; + + msgbuf_clear(&ibuf->w); + while ((fd = imsg_get_fd(ibuf)) != -1) + close(fd); } diff --git a/usr.sbin/relayd/imsg.c b/usr.sbin/relayd/imsg.c index aa39c209325..6f8474c15e5 100644 --- a/usr.sbin/relayd/imsg.c +++ b/usr.sbin/relayd/imsg.c @@ -1,4 +1,4 @@ -/* $OpenBSD: imsg.c,v 1.28 2009/06/08 08:30:06 dlg Exp $ */ +/* $OpenBSD: imsg.c,v 1.29 2009/08/08 18:33:40 nicm Exp $ */ /* * Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org> @@ -263,6 +263,9 @@ imsg_flush(struct imsgbuf *ibuf) void imsg_clear(struct imsgbuf *ibuf) { - while (ibuf->w.queued) - msgbuf_clear(&ibuf->w); + int fd; + + msgbuf_clear(&ibuf->w); + while ((fd = imsg_get_fd(ibuf)) != -1) + close(fd); } diff --git a/usr.sbin/ripd/imsg.c b/usr.sbin/ripd/imsg.c index 7a8184a8571..83acd42c025 100644 --- a/usr.sbin/ripd/imsg.c +++ b/usr.sbin/ripd/imsg.c @@ -1,4 +1,4 @@ -/* $OpenBSD: imsg.c,v 1.7 2009/06/08 08:30:06 dlg Exp $ */ +/* $OpenBSD: imsg.c,v 1.8 2009/08/08 18:33:40 nicm Exp $ */ /* * Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org> @@ -263,6 +263,9 @@ imsg_flush(struct imsgbuf *ibuf) void imsg_clear(struct imsgbuf *ibuf) { - while (ibuf->w.queued) - msgbuf_clear(&ibuf->w); + int fd; + + msgbuf_clear(&ibuf->w); + while ((fd = imsg_get_fd(ibuf)) != -1) + close(fd); } diff --git a/usr.sbin/smtpd/imsg.c b/usr.sbin/smtpd/imsg.c index 3bdc9a9becb..eb467dc5aa3 100644 --- a/usr.sbin/smtpd/imsg.c +++ b/usr.sbin/smtpd/imsg.c @@ -1,4 +1,4 @@ -/* $OpenBSD: imsg.c,v 1.10 2009/06/08 08:30:06 dlg Exp $ */ +/* $OpenBSD: imsg.c,v 1.11 2009/08/08 18:33:40 nicm Exp $ */ /* * Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org> @@ -263,6 +263,9 @@ imsg_flush(struct imsgbuf *ibuf) void imsg_clear(struct imsgbuf *ibuf) { - while (ibuf->w.queued) - msgbuf_clear(&ibuf->w); + int fd; + + msgbuf_clear(&ibuf->w); + while ((fd = imsg_get_fd(ibuf)) != -1) + close(fd); } diff --git a/usr.sbin/snmpd/imsg.c b/usr.sbin/snmpd/imsg.c index 3bdc9a9becb..eb467dc5aa3 100644 --- a/usr.sbin/snmpd/imsg.c +++ b/usr.sbin/snmpd/imsg.c @@ -1,4 +1,4 @@ -/* $OpenBSD: imsg.c,v 1.10 2009/06/08 08:30:06 dlg Exp $ */ +/* $OpenBSD: imsg.c,v 1.11 2009/08/08 18:33:40 nicm Exp $ */ /* * Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org> @@ -263,6 +263,9 @@ imsg_flush(struct imsgbuf *ibuf) void imsg_clear(struct imsgbuf *ibuf) { - while (ibuf->w.queued) - msgbuf_clear(&ibuf->w); + int fd; + + msgbuf_clear(&ibuf->w); + while ((fd = imsg_get_fd(ibuf)) != -1) + close(fd); } diff --git a/usr.sbin/ypldap/imsg.c b/usr.sbin/ypldap/imsg.c index 825265606ef..6554c408e98 100644 --- a/usr.sbin/ypldap/imsg.c +++ b/usr.sbin/ypldap/imsg.c @@ -1,4 +1,4 @@ -/* $OpenBSD: imsg.c,v 1.8 2009/06/08 08:30:06 dlg Exp $ */ +/* $OpenBSD: imsg.c,v 1.9 2009/08/08 18:33:40 nicm Exp $ */ /* * Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org> @@ -263,6 +263,9 @@ imsg_flush(struct imsgbuf *ibuf) void imsg_clear(struct imsgbuf *ibuf) { - while (ibuf->w.queued) - msgbuf_clear(&ibuf->w); + int fd; + + msgbuf_clear(&ibuf->w); + while ((fd = imsg_get_fd(ibuf)) != -1) + close(fd); } |