summaryrefslogtreecommitdiff
path: root/usr.sbin/smtpd
diff options
context:
space:
mode:
authorNicholas Marriott <nicm@cvs.openbsd.org>2009-08-08 18:33:41 +0000
committerNicholas Marriott <nicm@cvs.openbsd.org>2009-08-08 18:33:41 +0000
commit45cf1594f717b07d27721e90d7afa7b7a1171424 (patch)
treef9b348837314e441dbe90698f84af7e933ba5ec8 /usr.sbin/smtpd
parent73bc8536f568c8dfe3319d3e30304246ac831856 (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
Diffstat (limited to 'usr.sbin/smtpd')
-rw-r--r--usr.sbin/smtpd/imsg.c9
1 files changed, 6 insertions, 3 deletions
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);
}